WIP font
This commit is contained in:
parent
cf89dc9e8b
commit
69b372d036
6 changed files with 78 additions and 5 deletions
|
@ -58,7 +58,7 @@
|
|||
|
||||
# Your custom packages
|
||||
# Acessible through 'nix build', 'nix shell', etc
|
||||
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
|
||||
packages = forAllSystems (system: import ./pkgs {pkgs = nixpkgs.legacyPackages.${system};});
|
||||
|
||||
# Formatter for your nix files, available through 'nix fmt'
|
||||
# Other options beside 'alejandra' include 'nixpkgs-fmt'
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
# Custom packages, that can be defined similarly to ones from nixpkgs
|
||||
# You can build them using 'nix build .#example'
|
||||
{pkgs, ...}: {
|
||||
iosevka-lyte-term = pkgs.callPackage ./iosevka-lyte-term.nix {inherit pkgs;};
|
||||
{pkgs, ...}: rec {
|
||||
iosevka-lyte-term = pkgs.callPackage ./iosevka-lyte-term.nix {inherit (pkgs) iosevka;};
|
||||
iosevka-lyte-term-min = pkgs.callPackage ./iosevka-lyte-term-min.nix {
|
||||
inherit pkgs;
|
||||
inherit (pkgs) brotli;
|
||||
inherit iosevka-lyte-term;
|
||||
fonttools = pkgs.python311Packages.fonttools;
|
||||
};
|
||||
# example = pkgs.callPackage ./example { };
|
||||
}
|
||||
|
|
29
pkgs/iosevka-lyte-term-min.nix
Normal file
29
pkgs/iosevka-lyte-term-min.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
pkgs,
|
||||
fonttools,
|
||||
brotli,
|
||||
iosevka-lyte-term,
|
||||
...
|
||||
}: let
|
||||
BASE_FONTS = "${iosevka-lyte-term}/share/fonts/truetype";
|
||||
in
|
||||
pkgs.stdenvNoCC.mkDerivation {
|
||||
inherit BASE_FONTS;
|
||||
pname = "iosevka-lyte-term-min";
|
||||
version = iosevka-lyte-term.version;
|
||||
# do I need to include makesubset.bash and subset-glyphs.txt?
|
||||
buildInputs = [fonttools brotli];
|
||||
srcs = [
|
||||
BASE_FONTS
|
||||
./makesubset.bash
|
||||
];
|
||||
installPhase = ''
|
||||
mkdir -p "$out/share/fonts/truetype"
|
||||
for f in "$BASE_FONTS"/dist/iosevkalyteweb/woff2/*.woff2; do
|
||||
if [[ $f == *".subset.woff2"* ]]; then
|
||||
pyftsubset "$f" --name-IDs+=0,4,6 --text-file=./subset-glyphs.txt --flavor=woff2 &
|
||||
fi
|
||||
done
|
||||
wait
|
||||
'';
|
||||
}
|
|
@ -1,6 +1,28 @@
|
|||
{pkgs, ...}:
|
||||
pkgs.iosevka.override {
|
||||
{iosevka, ...}:
|
||||
(iosevka.overrideAttrs
|
||||
(final: prev: {
|
||||
pname = "iosevka-lyte-term";
|
||||
|
||||
buildPhase = ''
|
||||
export HOME=$TMPDIR
|
||||
runHook preBuild
|
||||
npm run build --no-update-notifier -- --jCmd=$NIX_BUILD_CORES --verbose=9 ttf::iosevka-lyteterm
|
||||
npm run build --no-update-notifier -- --jCmd=$NIX_BUILD_CORES --verbose=9 woff2::iosevka-lyteterm
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
fontdir="$out/share/fonts"
|
||||
install -d "$fontdir"
|
||||
install "dist/$pname/ttf"/* "$fontdir/truetype"
|
||||
install "dist/$pname/woff2"/* "$fontdir/woff2"
|
||||
runHook postInstall
|
||||
'';
|
||||
}))
|
||||
.override {
|
||||
set = "lyteterm";
|
||||
|
||||
privateBuildPlan = ''
|
||||
[buildPlans.iosevka-lyteterm]
|
||||
family = "IosevkaLyteTerm"
|
||||
|
|
15
pkgs/makesubset.bash
Normal file
15
pkgs/makesubset.bash
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo "out: $out"
|
||||
echo "src: $src"
|
||||
echo "BASE_FONTS: $BASE_FONTS"
|
||||
echo "srcs: $srcs"
|
||||
mkdir -p "$out/share/fonts/truetype"
|
||||
for f in "$src"/dist/iosevkalyteweb/woff2/*.woff2; do
|
||||
if [[ $f == *".subset.woff2"* ]]; then
|
||||
pyftsubset "$f" --name-IDs+=0,4,6 --text-file=./subset-glyphs.txt --flavor=woff2 &
|
||||
fi
|
||||
done
|
||||
wait
|
||||
mv ./dist/iosevkalyteweb/woff2/*.subset.woff2 ./dist/iosevkalyteweb/woff2-subset/
|
||||
touch ./dist/iosevkalyteweb/woff2-subset/
|
1
pkgs/subset-glyphs.txt
Normal file
1
pkgs/subset-glyphs.txt
Normal file
|
@ -0,0 +1 @@
|
|||
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ … ⎜⎡⎣─│┊└├┬╯░▒♯
|
Loading…
Reference in a new issue