From 77b051fd6f03404e0047c36e308074d2403889b5 Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Fri, 5 Apr 2024 16:41:07 +0800 Subject: [PATCH] nixos/fonts: use vf only --- .../common/graphical/home/fonts/default.nix | 22 +++++++++++++++++-- .../common/graphical/home/fonts/fonts.conf | 4 ++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/nixos/profiles/common/graphical/home/fonts/default.nix b/nixos/profiles/common/graphical/home/fonts/default.nix index f07b4c2..4c34caf 100644 --- a/nixos/profiles/common/graphical/home/fonts/default.nix +++ b/nixos/profiles/common/graphical/home/fonts/default.nix @@ -44,11 +44,29 @@ # The reason I use Source Han instead of Noto CJK, # is because I heard from #archlinux-cn, Adobe packages font better. # You can 100% use noto-fonts-cjk-{sans,serif} if you prefer consistency/other reason. + # + # Using VF to reduce closure size: + # Version 1579 -> 1580: + # home-manager: -10.4 KiB + # inter: -12695.6 KiB + # jetbrains-mono: -7621.0 KiB fonts.fontconfig.enable = true; home.packages = with pkgs; [ (nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];}) - inter - jetbrains-mono + (inter.overrideAttrs { + installPhase = '' + runHook preInstall + install -Dm644 -t $out/share/fonts/truetype/ InterVariable*.ttf + runHook postInstall + ''; + }) + (jetbrains-mono.overrideAttrs { + installPhase = '' + runHook preInstall + install -Dm644 -t $out/share/fonts/truetype/ fonts/variable/*.ttf + runHook postInstall + ''; + }) noto-fonts noto-fonts-color-emoji source-han-sans-vf-otf diff --git a/nixos/profiles/common/graphical/home/fonts/fonts.conf b/nixos/profiles/common/graphical/home/fonts/fonts.conf index 51cbe55..421d560 100644 --- a/nixos/profiles/common/graphical/home/fonts/fonts.conf +++ b/nixos/profiles/common/graphical/home/fonts/fonts.conf @@ -28,7 +28,7 @@ sans-serif - Inter + Inter Variable Source Han Sans SC VF Noto Color Emoji @@ -46,7 +46,7 @@ system-ui - Inter + Inter Variable Source Han Sans SC VF Noto Color Emoji