nix/pkgs/iosevka-lyteterm-webmin.nix
2024-02-03 10:51:20 -06:00

32 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,
iosevka-lyteterm-raw,
...
}: let
BASE_FONTS = "${iosevka-lyteterm-raw}/iosevka-lyteterm";
in
pkgs.stdenvNoCC.mkDerivation {
inherit BASE_FONTS;
pname = "iosevka-lyteterm-webmin";
version = iosevka-lyteterm-raw.version;
buildInputs = [parallel] ++ (with python311Packages; [fonttools brotli]);
PYTHONPATH = pkgs.python3.withPackages (pp: with pp; [brotli]);
srcs = [
BASE_FONTS
];
installPhase = ''
cp "$BASE_FONTS"/woff2/*.woff2 ./
cp "$BASE_FONTS"/ttf/*.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
'';
}