Commit 702bb59

HPCesia <me@hpcesia.com>
2025-09-30 18:07:50
refactor: font config
1 parent be264ba
Changed files (5)
modules
os-modules
nixos
desktop
modules/desktop/apps/terminal/ghostty/default.nix
@@ -13,6 +13,7 @@
         window-width = 128;
         window-new-tab-position = "current";
         copy-on-select = false;
+        font-family = "Maple Mono CN";
       };
     };
   };
modules/desktop/fonts/default.nix
@@ -0,0 +1,34 @@
+{
+  flake.modules.nixos.desktop = {pkgs, ...}: {
+    fonts = {
+      enableDefaultPackages = false;
+      fontDir.enable = true;
+
+      packages = with pkgs; [
+        nur.repos.rewine.ttf-ms-win10
+
+        noto-fonts
+        noto-fonts-emoji
+
+        source-sans
+        source-serif
+        source-han-sans
+        source-han-serif
+
+        lxgw-wenkai
+        smiley-sans
+
+        nerd-fonts.symbols-only
+        jetbrains-mono
+        maple-mono.CN
+      ];
+
+      fontconfig.defaultFonts = {
+        serif = ["Source Han Serif SC" "Source Han Serif TC" "Noto Color Emoji"];
+        sansSerif = ["Source Han Sans SC" "Source Han Sans TC" "Noto Color Emoji"];
+        monospace = ["JetBrains Mono" "Maple Mono CN" "Noto Color Emoji" "NerdFontsSymbolsOnly"];
+        emoji = ["Noto Color Emoji"];
+      };
+    };
+  };
+}
modules/desktop/fonts/plasma.nix
@@ -0,0 +1,39 @@
+{lib, ...}: {
+  flake.modules.homeManager.desktop = {
+    config,
+    osConfig,
+    ...
+  }: let
+    hasPlasma =
+      osConfig.services.desktopManager.plasma6.enable
+      && lib.hasAttr "plasma" config.programs
+      && config.programs.plasma.enable;
+  in {
+    programs.plasma.fonts = lib.mkIf hasPlasma {
+      general = {
+        family = "Source Han Sans SC";
+        pointSize = 12;
+      };
+      fixedWidth = {
+        family = "Maple Mono CN";
+        pointSize = 12;
+      };
+      menu = {
+        family = "Source Han Sans SC";
+        pointSize = 12;
+      };
+      small = {
+        family = "Source Han Sans SC";
+        pointSize = 10;
+      };
+      toolbar = {
+        family = "Source Han Sans SC";
+        pointSize = 12;
+      };
+      windowTitle = {
+        family = "Source Han Sans SC";
+        pointSize = 12;
+      };
+    };
+  };
+}
modules/desktop/kmscon.nix
@@ -0,0 +1,22 @@
+{lib, ...}: {
+  flake.modules.nixos.desktop = {pkgs, ...}: {
+    # https://wiki.archlinux.org/title/KMSCON
+    services.kmscon = {
+      # Use kmscon as the virtual console instead of gettys.
+      # kmscon is a kms/dri-based userspace virtual terminal implementation.
+      # It supports a richer feature set than the standard linux console VT,
+      # including full unicode support, and when the video card supports drm should be much faster.
+      enable = true;
+      fonts = [
+        {
+          name = "JetBrains Mono";
+          package = pkgs.jetbrains-mono;
+        }
+      ];
+      extraOptions = "--term xterm-256color";
+      extraConfig = lib.mkDefault "font-size=12";
+      # Whether to use 3D hardware acceleration to render the console.
+      hwRender = true;
+    };
+  };
+}
os-modules/nixos/desktop/fonts.nix
@@ -1,58 +0,0 @@
-{
-  pkgs,
-  lib,
-  ...
-}: {
-  fonts = {
-    enableDefaultPackages = false;
-    fontDir.enable = true;
-
-    packages = with pkgs; [
-      nur.repos.rewine.ttf-ms-win10
-
-      noto-fonts
-      # noto-fonts-cjk-sans
-      # noto-fonts-cjk-serif
-      noto-fonts-emoji
-      # noto-fonts-extra
-
-      source-sans
-      source-serif
-      source-han-sans
-      source-han-serif
-
-      lxgw-wenkai
-
-      maple-mono.NF-CN
-    ];
-
-    # user defined fonts
-    # the reason there's Noto Color Emoji everywhere is to override DejaVu's
-    # B&W emojis that would sometimes show instead of some Color emojis
-    fontconfig.defaultFonts = {
-      serif = ["Source Han Serif SC" "Source Han Serif TC" "Noto Color Emoji"];
-      sansSerif = ["Source Han Sans SC" "Source Han Sans TC" "Noto Color Emoji"];
-      monospace = ["Maple Mono NF CN" "Noto Color Emoji"];
-      emoji = ["Noto Color Emoji"];
-    };
-  };
-
-  # https://wiki.archlinux.org/title/KMSCON
-  services.kmscon = {
-    # Use kmscon as the virtual console instead of gettys.
-    # kmscon is a kms/dri-based userspace virtual terminal implementation.
-    # It supports a richer feature set than the standard linux console VT,
-    # including full unicode support, and when the video card supports drm should be much faster.
-    enable = true;
-    fonts = [
-      {
-        name = "JetBrains Mono";
-        package = pkgs.jetbrains-mono;
-      }
-    ];
-    extraOptions = "--term xterm-256color";
-    extraConfig = lib.mkDefault "font-size=12";
-    # Whether to use 3D hardware acceleration to render the console.
-    hwRender = true;
-  };
-}