From 77c95c11404db5f38d69b0dc1b366564d0f19e88 Mon Sep 17 00:00:00 2001
From: Jo <johannesreckers2006@gmail.com>
Date: Sat, 7 Sep 2024 08:16:13 +0200
Subject: [PATCH] feat(module): add font management nixos module

---
 modules/nixos/system/fonts/default.nix | 37 ++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 modules/nixos/system/fonts/default.nix

diff --git a/modules/nixos/system/fonts/default.nix b/modules/nixos/system/fonts/default.nix
new file mode 100644
index 0000000..23e2746
--- /dev/null
+++ b/modules/nixos/system/fonts/default.nix
@@ -0,0 +1,37 @@
+{
+  lib,
+  pkgs,
+  namespace,
+  config,
+  options,
+  ...
+}: with lib; with lib.${namespace};
+let
+  cfg = config.${namespace}.system.fonts;
+in {
+  options.${namespace}.system.fonts = {
+    enable = mkEnableOption "Enable system font management";
+    fonts = mkOption {
+      type = types.package;
+      default = [ ];
+      example = [ noto-fonts noto-fonts-emoji ];
+      description = "Install additional font packages";
+    }
+  };
+
+  config = mkIf cfg.enable {
+    environment.variables = {
+      LOG_ICONS = "true"; # Enable icons in tooling (requires nerdfonts)
+    };
+
+    environment.systemPackages = with pkgs; [ font-manager ];
+
+    fonts.packages = with pkgs; [
+      noto-fonts
+      noto-fonts-cjk-sans
+      noto-fonts-cjk-serif
+      noto-fonts-emoji
+      (nerdfonts.override { fonts = [ "Hack" ]; })
+    ] ++ cfg.fonts;
+  };
+}