nix/packages/iosevkaLyteTermSubset.nix
2024-06-01 21:25:58 -05:00

29 lines
1.1 KiB
Nix
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
pkgs,
parallel,
python311Packages,
iosevkaLyteTerm,
...
}:
pkgs.stdenvNoCC.mkDerivation {
inherit (iosevkaLyteTerm) version;
pname = "${iosevkaLyteTerm.pname}Subset";
buildInputs = [parallel] ++ (with python311Packages; [fonttools brotli]);
PYTHONPATH = pkgs.python3.withPackages (pp: with pp; [brotli]);
src = iosevkaLyteTerm;
installPhase = ''
ls -la "${iosevkaLyteTerm}/share/fonts/woff2"
cp "${iosevkaLyteTerm}"/share/fonts/woff2/*.woff2 ./
cp "${iosevkaLyteTerm}"/share/fonts/truetype/*.ttf ./
echo ' !"#$%&'"'"'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ' > ./subset-glyphs.txt
mkdir -p "$out/share/fonts/woff2"
mkdir -p "$out/share/fonts/truetype"
parallel pyftsubset --name-IDs+=0,4,6 --text-file=./subset-glyphs.txt --flavor=woff2 ::: ./*.woff2
parallel pyftsubset --name-IDs+=0,4,6 --text-file=./subset-glyphs.txt ::: ./*.ttf
cp ./*.subset.woff2 "$out/share/fonts/woff2"
cp ./*.subset.ttf "$out/share/fonts/truetype"
ls -laR
'';
}