about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/common/fonts.nix25
-rw-r--r--modules/darwin/fonts.nix6
-rw-r--r--modules/nixos/fonts.nix52
3 files changed, 45 insertions, 38 deletions
diff --git a/modules/common/fonts.nix b/modules/common/fonts.nix
index f3a79c2..adf6a3f 100644
--- a/modules/common/fonts.nix
+++ b/modules/common/fonts.nix
@@ -1,12 +1,9 @@
 {
-  config,
   lib,
   pkgs,
   ...
 }:
-with lib; let
-  cfg = config.nixfiles.modules.fonts;
-in {
+with lib; {
   imports = [
     (mkAliasOptionModule ["fontScheme"] [
       "nixfiles"
@@ -19,6 +16,17 @@ in {
   options.nixfiles.modules.fonts = {
     enable = mkEnableOption "fonts and their configurations";
 
+    packages = mkOption {
+      description = "Font packages to install.";
+      type = with types; listOf package;
+      default = with pkgs; [
+        (iosevka-bin.override {variant = "aile";})
+        (iosevka-bin.override {variant = "etoile";})
+        iosevka-bin
+        sarasa-gothic
+      ];
+    };
+
     fontScheme = let
       mkFont = {
         family,
@@ -79,13 +87,4 @@ in {
       };
     };
   };
-
-  config = mkIf cfg.enable {
-    fonts.packages = with pkgs; [
-      (iosevka-bin.override {variant = "aile";})
-      (iosevka-bin.override {variant = "etoile";})
-      iosevka-bin
-      sarasa-gothic
-    ];
-  };
 }
diff --git a/modules/darwin/fonts.nix b/modules/darwin/fonts.nix
index 741fdc8..c52d73e 100644
--- a/modules/darwin/fonts.nix
+++ b/modules/darwin/fonts.nix
@@ -7,6 +7,10 @@ with lib; let
   cfg = config.nixfiles.modules.fonts;
 in {
   config = mkIf cfg.enable {
-    fonts.fontDir.enable = true;
+    fonts = {
+      fonts = cfg.packages;
+
+      fontDir.enable = true;
+    };
   };
 }
diff --git a/modules/nixos/fonts.nix b/modules/nixos/fonts.nix
index d4a7330..f11a27d 100644
--- a/modules/nixos/fonts.nix
+++ b/modules/nixos/fonts.nix
@@ -9,31 +9,35 @@ in {
   config = mkMerge [
     (mkIf cfg.enable {
       hm.fonts.fontconfig.enable = true;
-      fonts.fontconfig = {
-        enable = true;
+      fonts = {
+        inherit (cfg) packages;
 
-        defaultFonts = {
-          monospace = [
-            "Iosevka"
-            "Sarasa Mono K"
-            "Sarasa Mono J"
-            "Sarasa Mono SC"
-            "Sarasa Mono CL"
-          ];
-          sansSerif = [
-            "Iosevka Aile"
-            "Sarasa Gothic K"
-            "Sarasa Gothic J"
-            "Sarasa Gothic SC"
-            "Sarasa Gothic CL"
-          ];
-          serif = [
-            "Iosevka Etoile"
-            "Sarasa Gothic K"
-            "Sarasa Gothic J"
-            "Sarasa Gothic SC"
-            "Sarasa Gothic CL"
-          ];
+        fontconfig = {
+          enable = true;
+
+          defaultFonts = {
+            monospace = [
+              "Iosevka"
+              "Sarasa Mono K"
+              "Sarasa Mono J"
+              "Sarasa Mono SC"
+              "Sarasa Mono CL"
+            ];
+            sansSerif = [
+              "Iosevka Aile"
+              "Sarasa Gothic K"
+              "Sarasa Gothic J"
+              "Sarasa Gothic SC"
+              "Sarasa Gothic CL"
+            ];
+            serif = [
+              "Iosevka Etoile"
+              "Sarasa Gothic K"
+              "Sarasa Gothic J"
+              "Sarasa Gothic SC"
+              "Sarasa Gothic CL"
+            ];
+          };
         };
       };
     })

Consider giving Nix/NixOS a try! <3