cascadia-code: add useVariableFont option

Cascadia Code provides variable .tff files. Defaulting to false to avoid altering the package's behavior.
This commit is contained in:
Géza Ahsendorf 2025-03-19 08:03:10 +01:00
parent a1351cd960
commit b96ad59034

View file

@ -2,14 +2,15 @@
lib, lib,
stdenvNoCC, stdenvNoCC,
fetchzip, fetchzip,
useVariableFont ? false,
}: }:
stdenvNoCC.mkDerivation rec { stdenvNoCC.mkDerivation (finalAttrs: {
pname = "cascadia-code"; pname = "cascadia-code";
version = "2407.24"; version = "2407.24";
src = fetchzip { src = fetchzip {
url = "https://github.com/microsoft/cascadia-code/releases/download/v${version}/CascadiaCode-${version}.zip"; url = "https://github.com/microsoft/cascadia-code/releases/download/v${finalAttrs.version}/CascadiaCode-${finalAttrs.version}.zip";
stripRoot = false; stripRoot = false;
hash = "sha256-bCQzGCvjSQ1TXFVC3w9VPXNtjM4h7lRvljVjX/w1TJ4="; hash = "sha256-bCQzGCvjSQ1TXFVC3w9VPXNtjM4h7lRvljVjX/w1TJ4=";
}; };
@ -17,8 +18,17 @@ stdenvNoCC.mkDerivation rec {
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
install -Dm644 otf/static/*.otf -t $out/share/fonts/opentype ${
install -Dm644 ttf/static/*.ttf -t $out/share/fonts/truetype if useVariableFont then
''
install -Dm644 ttf/*.ttf -t $out/share/fonts/truetype
''
else
''
install -Dm644 otf/static/*.otf -t $out/share/fonts/opentype
install -Dm644 ttf/static/*.ttf -t $out/share/fonts/truetype
''
}
runHook postInstall runHook postInstall
''; '';
@ -31,4 +41,4 @@ stdenvNoCC.mkDerivation rec {
maintainers = with maintainers; [ ryanccn ]; maintainers = with maintainers; [ ryanccn ];
platforms = platforms.all; platforms = platforms.all;
}; };
} })