Files
nixpkgs/pkgs/by-name/go/googlesans-code/package.nix
2026-06-10 07:31:00 +00:00

51 lines
1.3 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
fontc,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "googlesans-code";
version = "7.001";
src = fetchFromGitHub {
owner = "googlefonts";
repo = "googlesans-code";
tag = "v${finalAttrs.version}";
hash = "sha256-t0WNdfjc2jyg7kkKzwNN57NA9Fw4qK0PxcsxL5/k9XU=";
};
nativeBuildInputs = [
fontc
];
buildPhase = ''
runHook preBuild
mkdir -p fonts/variable
fontc sources/GoogleSansCode.glyphspackage --flatten-components --decompose-transformed-components --output-file "fonts/variable/GoogleSansCode[wght].ttf"
fontc sources/GoogleSansCode-Italic.glyphspackage --flatten-components --decompose-transformed-components --output-file "fonts/variable/GoogleSansCode-Italic[wght].ttf"
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/fonts/googlesans-code
cp fonts/variable/* $out/share/fonts/googlesans-code/
runHook postInstall
'';
meta = {
description = "Google Sans Code font family";
homepage = "https://github.com/googlefonts/googlesans-code";
changelog = "https://github.com/googlefonts/googlesans-code/blob/${finalAttrs.src.tag}/CHANGELOG.md";
license = lib.licenses.ofl;
maintainers = with lib.maintainers; [ shiphan ];
platforms = lib.platforms.all;
};
})