From 36825e26a5d33d439f46a2b7eff34eb974a92349 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Tue, 7 Jan 2025 08:18:05 +0000 Subject: [PATCH] Add and switch to modified build of Iosevka font Update Makefile for building and copying new fonts Adjust padding of parts of waybar, using variable width glyphs in Iosevka font --- Makefile | 8 +- flake.nix | 15 ++- system/default.nix | 34 ++++-- system/fonts.nix | 139 +++++++++++++++++++++++++ system/home/swww/dynamic-wallpaper.nix | 18 ++-- system/home/waybar.nix | 15 --- 6 files changed, 190 insertions(+), 39 deletions(-) create mode 100644 system/fonts.nix diff --git a/Makefile b/Makefile index 3255099d..e27384af 100644 --- a/Makefile +++ b/Makefile @@ -7,10 +7,12 @@ default: build build: nix build --no-link --keep-going .#nixosConfigurations.$(HOST).config.system.build.toplevel -server: +fonts: + nix build --no-link --max-jobs 1 .#iosevka-custom-aile .#iosevka-custom-etoile .#iosevka-custom-nerdfont + +server: fonts nixos-rebuild build --flake .#Legion - nix copy ./result --to ssh://legion - rm ./result + nix copy ./result --to ssh://legion && rm ./result flathub: flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo diff --git a/flake.nix b/flake.nix index 1e0f58f3..b6c43e7c 100644 --- a/flake.nix +++ b/flake.nix @@ -30,9 +30,22 @@ ... }: let - treefmt = treefmt-nix.lib.evalModule nixpkgs.legacyPackages.x86_64-linux ./treefmt.nix; + pkgs = nixpkgs.legacyPackages.x86_64-linux; + treefmt = treefmt-nix.lib.evalModule pkgs ./treefmt.nix; in { + packages.x86_64-linux = + let + fonts = pkgs.callPackage ./system/fonts.nix { }; + in + { + inherit (fonts) + iosevka-custom + iosevka-custom-aile + iosevka-custom-etoile + iosevka-custom-nerdfont + ; + }; formatter.x86_64-linux = treefmt.config.build.wrapper; checks.x86_64-linux.formatting = treefmt.config.build.check self; nixosConfigurations = { diff --git a/system/default.nix b/system/default.nix index cd92f8c4..f3481475 100644 --- a/system/default.nix +++ b/system/default.nix @@ -224,18 +224,30 @@ name = "volantes_cursors"; size = 32; }; - fonts = { - monospace = { - package = pkgs.nerdfonts.override { fonts = [ "DejaVuSansMono" ]; }; - name = "DejaVuSansM Nerd Font"; + fonts = + let + fpkgs = pkgs.callPackage ./fonts.nix { }; + in + { + serif = { + package = fpkgs.iosevka-custom-etoile; + name = "Iosevka Custom Etoile"; + }; + sansSerif = { + package = fpkgs.iosevka-custom-aile; + name = "Iosevka Custom Aile"; + }; + monospace = { + package = fpkgs.iosevka-custom-nerdfont; + name = "IosevkaCustom Nerd Font Propo"; + }; + sizes = { + applications = 12; + desktop = 14; + popups = 16; + terminal = 12; + }; }; - sizes = { - applications = 12; - desktop = 14; - popups = 16; - terminal = 12; - }; - }; }; fonts.packages = with pkgs; [ liberation_ttf # Documents diff --git a/system/fonts.nix b/system/fonts.nix new file mode 100644 index 00000000..1fde2b92 --- /dev/null +++ b/system/fonts.nix @@ -0,0 +1,139 @@ +{ + stdenv, + findutils, + iosevka, + nerd-font-patcher, +}: +let + custom-build-plan = { + noCvSs = false; + exportGlyphNames = false; + widths.Normal = { + shape = 500; + menu = 5; + css = "normal"; + }; + weights = { + Regular = { + shape = 400; + menu = 400; + css = 400; + }; + Bold = { + shape = 700; + menu = 700; + css = 700; + }; + }; + slopes = { + Upright = { + angle = 0; + shape = "upright"; + menu = "upright"; + css = "normal"; + }; + Italic = { + angle = 9.4; + shape = "italic"; + menu = "italic"; + css = "italic"; + }; + }; + variants.design = { + capital-g = "toothless-corner-serifless-hooked"; + capital-j = "serifed-both-sides"; + capital-k = "curly-serifless"; + capital-p = "closed-motion-serifed"; + capital-q = "crossing"; + capital-r = "curly-serifless"; + capital-u = "tailed-serifless"; + capital-z = "straight-serifless-with-horizontal-crossbar"; + a = "double-storey-tailed"; + d = "tailed-serifless"; + e = "rounded"; + f = "tailed-crossbar-at-x-height"; + g = "double-storey-open"; + h = "tailed-serifless"; + i = "tailed-serifed"; + j = "serifed"; + k = "cursive-serifless"; + l = "tailed-serifed"; + m = "tailed-serifless"; + n = "tailed-serifless"; + q = "diagonal-tailed-serifless"; + u = "tailed-serifless"; + y = "cursive-serifless"; + z = "straight-serifless-with-horizontal-crossbar"; + lower-delta = "flat-top"; + lower-lambda = "tailed-turn"; + lower-xi = "flat-top"; + lower-chi = "semi-chancery-straight-serifless"; + zero = "tall-slashed"; + one = "no-base"; + two = "straight-neck-serifless"; + three = "flat-top-serifless"; + four = "semi-open-serifless"; + five = "oblique-arched-serifless"; + six = "open-contour"; + seven = "bend-serifless-crossbar"; + eight = "two-circles"; + nine = "open-contour"; + asterisk = "hex-low"; + underscore = "high"; + caret = "high"; + paren = "normal"; + brace = "straight"; + number-sign = "slanted"; + ampersand = "closed"; + at = "fourfold"; + percent = "dots"; + question = "corner"; + lig-ltgteq = "flat"; + lig-neq = "more-slanted"; + lig-equal-chain = "without-notch"; + lig-hyphen-chain = "without-notch"; + lig-double-arrow-bar = "without-notch"; + lig-single-arrow-bar = "without-notch"; + }; + }; +in +rec { + iosevka-custom = iosevka.override { + set = "Custom"; + privateBuildPlan = custom-build-plan // { + family = "Iosevka Custom"; + spacing = "normal"; + serifs = "sans"; + }; + }; + iosevka-custom-aile = iosevka.override { + set = "CustomAile"; + privateBuildPlan = custom-build-plan // { + family = "Iosevka Custom Aile"; + spacing = "quasi-proportional"; + serifs = "sans"; + }; + }; + iosevka-custom-etoile = iosevka.override { + set = "CustomEtoile"; + privateBuildPlan = custom-build-plan // { + family = "Iosevka Custom Etoile"; + spacing = "quasi-proportional"; + serifs = "slab"; + }; + }; + iosevka-custom-nerdfont = stdenv.mkDerivation { + name = "${iosevka-custom.name}-nerd-font-patched"; + src = iosevka-custom; + nativeBuildInputs = [ + findutils + nerd-font-patcher + ]; + buildPhase = '' + find \( -name \*.ttf -o -name \*.otf \) -execdir nerd-font-patcher --variable-width-glyphs --careful --complete --boxdrawing --no-progressbars {} \; + ''; + installPhase = '' + cp -a . $out + ''; + }; +} diff --git a/system/home/swww/dynamic-wallpaper.nix b/system/home/swww/dynamic-wallpaper.nix index 560ae7f4..4d007d15 100644 --- a/system/home/swww/dynamic-wallpaper.nix +++ b/system/home/swww/dynamic-wallpaper.nix @@ -27,16 +27,16 @@ in imports = [ ./default.nix ]; systemd.user = { services.dynamic-wallpaper = { - Unit = { - Description = "Change wallpaper based on time of day"; - Wants = [ "swww-daemon.service" ]; - After = [ "swww-daemon.service" ]; - }; - Service = { - Type = "oneshot"; - ExecStart = "${dynamicWallpaper}/bin/dynamic-wallpaper"; - }; + Unit = { + Description = "Change wallpaper based on time of day"; + Wants = [ "swww-daemon.service" ]; + After = [ "swww-daemon.service" ]; }; + Service = { + Type = "oneshot"; + ExecStart = "${dynamicWallpaper}/bin/dynamic-wallpaper"; + }; + }; timers.dynamic-wallpaper.Timer = { OnCalendar = "*:0"; Unit = "dynamic-wallpaper.service"; diff --git a/system/home/waybar.nix b/system/home/waybar.nix index dc6a42a0..929a219f 100644 --- a/system/home/waybar.nix +++ b/system/home/waybar.nix @@ -334,9 +334,6 @@ padding: 2px 3px; } - #workspaces button { - padding: 2px 5px 2px 1px; - } #workspaces button.empty { color: ${scheme.base03}; } @@ -359,26 +356,17 @@ } #network { color: ${scheme.base0A}; - padding: 2px 6px 2px 1px; } #bluetooth { color: ${scheme.base0B}; } #clock.calendar { color: ${scheme.base0C}; - padding: 2px 3px 2px 3px; } #clock { color: ${scheme.base0D}; - padding: 2px 1px 2px 2px; } - #backlight { - padding: 2px 3px 2px 3px; - } - #battery { - padding: 2px 2px 2px 4px; - } #battery.warning { color: ${scheme.base09}; } @@ -390,9 +378,6 @@ color: ${scheme.base0B}; } - #systemd-failed-units { - padding: 2px 4px 2px 1px; - } #systemd-failed-units.ok { color: ${scheme.base0B} }