From e9a25dad207d2f3063dd456d10585461dee24d9b Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Sat, 3 Feb 2024 10:51:20 -0600 Subject: [PATCH] Font packages --- modules/nixos/fonts.nix | 2 +- nixos/htpc.nix | 9 +- pkgs/default.nix | 16 +-- pkgs/iosevka-lyteterm-min.nix | 29 ------ pkgs/iosevka-lyteterm-webmin.nix | 31 ++++++ pkgs/iosevka-lyteterm.nix | 164 ++++--------------------------- pkgs/makesubset.bash | 15 --- pkgs/subset-glyphs.txt | 1 - readme.md | 1 - 9 files changed, 64 insertions(+), 204 deletions(-) delete mode 100644 pkgs/iosevka-lyteterm-min.nix create mode 100644 pkgs/iosevka-lyteterm-webmin.nix delete mode 100644 pkgs/makesubset.bash delete mode 100644 pkgs/subset-glyphs.txt diff --git a/modules/nixos/fonts.nix b/modules/nixos/fonts.nix index dec6bbf..b905686 100644 --- a/modules/nixos/fonts.nix +++ b/modules/nixos/fonts.nix @@ -2,6 +2,6 @@ # fonts.packages if unstable? fonts.packages = with pkgs; [ (nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];}) - pkgs.iosevka-lyte-term + pkgs.iosevka-lyteterm ]; } diff --git a/nixos/htpc.nix b/nixos/htpc.nix index 33d465a..1645281 100644 --- a/nixos/htpc.nix +++ b/nixos/htpc.nix @@ -52,12 +52,13 @@ programs.steam.enable = true; programs.steam.remotePlay.openFirewall = true; - services.xserver.displayManager.autoLogin.enable = true; - services.xserver.displayManager.autoLogin.user = "daniel"; - services.xserver = { enable = true; - displayManager.lightdm.enable = true; + displayManager = { + # lightdm.enable = true; + autoLogin.enable = true; + autoLogin.user = "daniel"; + }; desktopManager.gnome.enable = true; videoDrivers = ["fbdev"]; }; diff --git a/pkgs/default.nix b/pkgs/default.nix index 81ddff6..21e5b3d 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,13 +1,13 @@ # Custom packages, that can be defined similarly to ones from nixpkgs # You can build them using 'nix build .#example' {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 { }; + + 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; + }; } diff --git a/pkgs/iosevka-lyteterm-min.nix b/pkgs/iosevka-lyteterm-min.nix deleted file mode 100644 index 6beb512..0000000 --- a/pkgs/iosevka-lyteterm-min.nix +++ /dev/null @@ -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 - ''; - } diff --git a/pkgs/iosevka-lyteterm-webmin.nix b/pkgs/iosevka-lyteterm-webmin.nix new file mode 100644 index 0000000..b6efe64 --- /dev/null +++ b/pkgs/iosevka-lyteterm-webmin.nix @@ -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 + ''; + } diff --git a/pkgs/iosevka-lyteterm.nix b/pkgs/iosevka-lyteterm.nix index f947946..0501422 100644 --- a/pkgs/iosevka-lyteterm.nix +++ b/pkgs/iosevka-lyteterm.nix @@ -1,147 +1,21 @@ -{iosevka, ...}: -(iosevka.overrideAttrs - (final: prev: { - pname = "iosevka-lyteterm"; - - 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 - ''; - +{ + pkgs, + iosevka-lyteterm-raw, + ... +}: let + BASE_FONTS = "${iosevka-lyteterm-raw}/iosevka-lyteterm/ttf"; +in + pkgs.stdenvNoCC.mkDerivation { + inherit BASE_FONTS; + pname = "iosevka-lyteterm-ttf"; + version = iosevka-lyteterm-raw.version; + srcs = [ + BASE_FONTS + ]; installPhase = '' - runHook preInstall - fontdir="$out/share/fonts" - ls -la "$pname" - ls -la "$pname/ttf"/* - install -d "$fontdir" - install "$pname/ttf"/* "$fontdir/truetype" - install "$pname/woff2"/* "$fontdir/woff2" - runHook postInstall + mkdir -p "$out/share/fonts/truetype" + for f in "$BASE_FONTS"/*.ttf; do + cp "$f" "$out/share/fonts/truetype" + done ''; - })) -.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' - ''; -} + } diff --git a/pkgs/makesubset.bash b/pkgs/makesubset.bash deleted file mode 100644 index 0812af7..0000000 --- a/pkgs/makesubset.bash +++ /dev/null @@ -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/ diff --git a/pkgs/subset-glyphs.txt b/pkgs/subset-glyphs.txt deleted file mode 100644 index 756d2b7..0000000 --- a/pkgs/subset-glyphs.txt +++ /dev/null @@ -1 +0,0 @@ - !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ‌… ⎜⎡⎣─│┊└├┬╯░▒♯ diff --git a/readme.md b/readme.md index 31afc33..b9ec7c3 100644 --- a/readme.md +++ b/readme.md @@ -66,7 +66,6 @@ See [lib/internal.md](./lib/internal.md). - a.lyte.dev for web analytics - grafana and stuff for monitoring - alerts? -- Fonts installed by home manager instead of nixos module - Broot config? ## Long Term