From 9042ed10af58ec82934770e0d7dcb0c1f36e9bfa Mon Sep 17 00:00:00 2001 From: Rachel Lambda Samuelsson Date: Sat, 18 Nov 2023 23:30:05 +0100 Subject: [PATCH] sax2 nerdfont --- flake.nix | 2 ++ home/rachel.nix | 6 +++--- shared/sax2.nix | 14 -------------- shared/sax2nf.nix | 24 ++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 17 deletions(-) delete mode 100644 shared/sax2.nix create mode 100644 shared/sax2nf.nix diff --git a/flake.nix b/flake.nix index 5713a79..734d6b7 100644 --- a/flake.nix +++ b/flake.nix @@ -60,5 +60,7 @@ }; keyboardLayouts.fox = ./shared/fox.xkb; + + fonts.sax2nf = import ./shared/sax2nf.nix { pkgs = nixpkgs.legacyPackages.x86_64-linux; }; }; } diff --git a/home/rachel.nix b/home/rachel.nix index ae4602f..2272f5b 100644 --- a/home/rachel.nix +++ b/home/rachel.nix @@ -1,7 +1,7 @@ { pkgs, cornelis, cornelis-vim, agda, ... }: let username = "rachel"; homeDir = "/home/${username}"; - SAX2 = import ../shared/sax2.nix { inherit pkgs; }; + SAX2NF = import ../shared/sax2nf.nix { inherit pkgs; }; hpkgs = pkgs.haskellPackages; hls_wrapper = pkgs.writeScript "hls" '' export PATH="${hpkgs.haskell-language-server}/bin:$PATH" @@ -64,7 +64,7 @@ in obs-studio file gimp - SAX2 + SAX2NF twemoji-color-font bat steam @@ -327,7 +327,7 @@ in draw_bold_text_with_bright_colors = false; scrolling.history = 0; font = { - normal.family = "SAX2"; + normal.family = "SAX2 Nerd Font"; size = 11; }; colors = { diff --git a/shared/sax2.nix b/shared/sax2.nix deleted file mode 100644 index 0da83ab..0000000 --- a/shared/sax2.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ pkgs, ... }: -pkgs.fetchurl { - name = "SAX2"; - url = "https://abrudz.github.io/SAX2/SAX2.ttf"; - sha256 = "sha256-DgvDWXO2fnKZNu9EvQOq8GNMTU3PUdp85+/0ZHdRXZc="; - - recursiveHash = true; - - downloadToTemp = true; - postFetch = '' - mkdir -p "$out/share/fonts/truetype" - mv "$downloadedFile" "$out/share/fonts/truetype/SAX2.ttf" - ''; -} diff --git a/shared/sax2nf.nix b/shared/sax2nf.nix new file mode 100644 index 0000000..d49d201 --- /dev/null +++ b/shared/sax2nf.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: +pkgs.stdenv.mkDerivation { + name = "SAX2"; + + sax2 = (pkgs.fetchurl { + url = "https://abrudz.github.io/SAX2/SAX2.ttf"; + sha256 = "sha256-t7Se4Hkojznrret/gb1y1uVnecENTuKtQv11ygafMPY="; + }); + + patcher = (pkgs.fetchzip { + url = "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/FontPatcher.zip"; + sha256 = "sha256-ZJpF/Q5lfcW3srb2NbJk+/QEuwaFjdzboa+rl9L7GGE="; + stripRoot = false; + }); + + dontUnpack = true; + + nativeBuildInputs = [ pkgs.fontforge (pkgs.python3.withPackages (p: [ p.fontforge ])) ]; + + buildPhase = '' + mkdir -p $out/share/fonts/truetype + python3 -OO $patcher/font-patcher --complete --careful --custom ${pkgs.fira-code}/share/fonts/truetype/FiraCode-VF.ttf -out $out/share/fonts/truetype $sax2 + ''; +}