Font packages

This commit is contained in:
Daniel Flanagan 2024-02-03 10:51:20 -06:00
parent 1712d88695
commit e9a25dad20
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
9 changed files with 64 additions and 204 deletions

View file

@ -2,6 +2,6 @@
# fonts.packages if unstable? # fonts.packages if unstable?
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [
(nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];}) (nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];})
pkgs.iosevka-lyte-term pkgs.iosevka-lyteterm
]; ];
} }

View file

@ -52,12 +52,13 @@
programs.steam.enable = true; programs.steam.enable = true;
programs.steam.remotePlay.openFirewall = true; programs.steam.remotePlay.openFirewall = true;
services.xserver.displayManager.autoLogin.enable = true;
services.xserver.displayManager.autoLogin.user = "daniel";
services.xserver = { services.xserver = {
enable = true; enable = true;
displayManager.lightdm.enable = true; displayManager = {
# lightdm.enable = true;
autoLogin.enable = true;
autoLogin.user = "daniel";
};
desktopManager.gnome.enable = true; desktopManager.gnome.enable = true;
videoDrivers = ["fbdev"]; videoDrivers = ["fbdev"];
}; };

View file

@ -1,13 +1,13 @@
# Custom packages, that can be defined similarly to ones from nixpkgs # Custom packages, that can be defined similarly to ones from nixpkgs
# You can build them using 'nix build .#example' # You can build them using 'nix build .#example'
{pkgs, ...}: rec { {pkgs, ...}: rec {
iosevka-lyteterm-raw = pkgs.callPackage ./iosevka-lyteterm-raw.nix {inherit (pkgs) iosevka;};
iosevka-lyteterm = pkgs.callPackage ./iosevka-lyteterm.nix {inherit (pkgs) iosevka;};
iosevka-lyteterm-min = pkgs.callPackage ./iosevka-lyteterm-min.nix {
inherit pkgs;
inherit (pkgs) brotli;
inherit iosevka-lyteterm;
fonttools = pkgs.python311Packages.fonttools;
};
# example = pkgs.callPackage ./example { }; # example = pkgs.callPackage ./example { };
iosevka-lyteterm-raw = pkgs.callPackage ./iosevka-lyteterm-raw.nix {inherit (pkgs) iosevka;};
iosevka-lyteterm = pkgs.callPackage ./iosevka-lyteterm.nix {inherit iosevka-lyteterm-raw;};
iosevka-lyteterm-webmin = pkgs.callPackage ./iosevka-lyteterm-webmin.nix {
inherit pkgs;
inherit (pkgs) python311Packages parallel;
inherit iosevka-lyteterm-raw;
};
} }

View file

@ -1,29 +0,0 @@
{
pkgs,
fonttools,
brotli,
iosevka-lyteterm,
...
}: let
BASE_FONTS = "${iosevka-lyteterm}/share/fonts/truetype";
in
pkgs.stdenvNoCC.mkDerivation {
inherit BASE_FONTS;
pname = "iosevka-lyteterm-min";
version = iosevka-lyteterm.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
'';
}

View file

@ -0,0 +1,31 @@
{
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
'';
}

View file

@ -1,147 +1,21 @@
{iosevka, ...}: {
(iosevka.overrideAttrs pkgs,
(final: prev: { iosevka-lyteterm-raw,
pname = "iosevka-lyteterm"; ...
}: let
buildPhase = '' BASE_FONTS = "${iosevka-lyteterm-raw}/iosevka-lyteterm/ttf";
export HOME=$TMPDIR in
runHook preBuild pkgs.stdenvNoCC.mkDerivation {
npm run build --no-update-notifier -- --jCmd=$NIX_BUILD_CORES --verbose=9 ttf::iosevka-lyteterm inherit BASE_FONTS;
npm run build --no-update-notifier -- --jCmd=$NIX_BUILD_CORES --verbose=9 woff2::iosevka-lyteterm pname = "iosevka-lyteterm-ttf";
runHook postBuild version = iosevka-lyteterm-raw.version;
''; srcs = [
BASE_FONTS
];
installPhase = '' installPhase = ''
runHook preInstall mkdir -p "$out/share/fonts/truetype"
fontdir="$out/share/fonts" for f in "$BASE_FONTS"/*.ttf; do
ls -la "$pname" cp "$f" "$out/share/fonts/truetype"
ls -la "$pname/ttf"/* done
install -d "$fontdir"
install "$pname/ttf"/* "$fontdir/truetype"
install "$pname/woff2"/* "$fontdir/woff2"
runHook postInstall
'';
}))
.override {
set = "lyteterm";
privateBuildPlan = ''
[buildPlans.iosevka-lyteterm]
family = "IosevkaLyteTerm"
spacing = "fontconfig-mono"
serifs = "sans"
export-glyph-names = true
[buildPlans.iosevka-lyteterm.ligations]
inherits = "dlig"
disables = [ "exeqeqeq", "exeqeq", "exeqeq-dl", "exeq", "ineq", "connected-underscore", "connected-tilde-as-wave" ]
[buildPlans.iosevka-lyteterm.weights.regular]
shape = 400
menu = 400
css = 400
[buildPlans.iosevka-lyteterm.weights.book]
shape = 450
menu = 450
css = 450
[buildPlans.iosevka-lyteterm.weights.bold]
shape = 700
menu = 700
css = 700
[buildPlans.iosevka-lyteterm.weights.black]
shape = 900
menu = 900
css = 900
# [[buildPlans.iosevka-lyteterm.compatibility-ligatures]]
# unicode = 57600 # 0xE100
# featureTag = 'calt'
# kequence = '<*>'
[buildPlans.iosevka-lyteterm.variants]
inherits = "ss01"
[buildPlans.iosevka-lyteterm.variants.design]
capital-a = 'curly-serifless'
capital-b = 'standard-interrupted-serifless'
capital-c = 'unilateral-inward-serifed'
capital-d = 'standard-serifless'
capital-g = 'toothless-rounded-inward-serifed-hooked'
capital-i = 'serifed'
capital-j = 'serifed'
capital-k = 'curly-serifless'
capital-l = 'motion-serifed'
capital-m = 'hanging-serifless'
capital-n = 'asymmetric-serifless'
capital-p = 'open-serifless'
capital-q = 'crossing'
capital-r = 'standing-open-serifless'
capital-s = 'unilateral-inward-serifed'
capital-t = 'motion-serifed'
capital-u = 'toothless-corner-serifless'
capital-v = 'curly-serifless'
capital-w = 'curly-serifless'
capital-x = 'curly-serifless'
capital-y = 'curly-base-serifed'
capital-z = 'curly-top-serifed-with-crossbar'
a = 'double-storey-toothless-corner'
b = 'toothless-corner-serifless'
c = 'unilateral-inward-serifed'
d = 'toothless-corner-serifless'
e = 'flat-crossbar'
f = 'tailed'
g = 'double-storey-open'
# g = 'single-storey-earless-corner-flat-hook'
h = 'straight-serifless'
i = 'tailed-serifed'
j = 'serifed'
k = 'curly-serifless'
l = 'tailed-serifed'
m = 'earless-corner-double-arch-serifless'
n = 'earless-corner-straight-serifless'
p = 'earless-corner-serifless'
q = 'earless-corner-diagonal-tailed-serifless'
r = 'earless-corner-serifless'
s = 'unilateral-inward-serifed'
t = 'bent-hook-asymmetric'
u = 'toothless-corner-serifless'
v = 'curly-serifless'
w = 'curly-serifless'
x = 'curly-serifless'
y = 'curly-turn-serifless'
z = 'curly-top-serifed-with-crossbar'
# cyrl-capital-ze = 'unilateral-inward-serifed'
zero = 'reverse-slashed-split'
one = 'base'
two = 'curly-neck'
three = 'two-arcs'
four = 'semi-open-non-crossing'
# five = 'vertical-upper-left-bar'
five = 'upright-flat'
six = 'straight-bar'
seven = 'curly-serifed-crossbar'
eight = 'two-circles'
nine = 'straight-bar'
tilde = 'low'
asterisk = 'penta-low'
underscore = 'above-baseline'
pilcrow = 'low'
caret = 'low'
paren = 'flat-arc'
brace = 'curly-flat-boundary'
number-sign = 'upright-open'
ampersand = 'upper-open'
at = 'compact'
dollar = 'interrupted'
cent = 'open'
percent = 'rings-segmented-slash'
bar = 'force-upright'
ascii-single-quote = 'raised-comma'
ascii-grave = 'straight'
question = 'smooth'
punctuation-dot = 'round'
''; '';
} }

View file

@ -1,15 +0,0 @@
#!/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/

View file

@ -1 +0,0 @@
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ‌… ⎜⎡⎣─│┊└├┬╯░▒♯

View file

@ -66,7 +66,6 @@ See [lib/internal.md](./lib/internal.md).
- a.lyte.dev for web analytics - a.lyte.dev for web analytics
- grafana and stuff for monitoring - grafana and stuff for monitoring
- alerts? - alerts?
- Fonts installed by home manager instead of nixos module
- Broot config? - Broot config?
## Long Term ## Long Term