about summary refs log tree commit diff
path: root/modules/nixos
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-03-02 20:30:02 +0300
committerAzat Bahawi <azat@bahawi.net>2024-03-02 20:30:02 +0300
commit482bcef47a3b7ee63553c58d200065857ec42b1c (patch)
treeface7032b62c8957df4a84b2fc0c4adc47020f9e /modules/nixos
parent2024-03-01 (diff)
2024-03-02
Diffstat (limited to '')
-rw-r--r--modules/nixos/common/console.nix2
-rw-r--r--modules/nixos/common/default.nix1
-rw-r--r--modules/nixos/common/stylix.nix37
-rw-r--r--modules/nixos/default.nix1
-rw-r--r--modules/nixos/dwm.nix23
-rw-r--r--modules/nixos/firefox/default.nix57
-rw-r--r--modules/nixos/fonts.nix78
-rw-r--r--modules/nixos/git/default.nix2
-rw-r--r--modules/nixos/kde.nix21
-rw-r--r--modules/nixos/profiles/headful.nix1
-rw-r--r--modules/nixos/thunderbird.nix8
-rw-r--r--modules/nixos/x11.nix44
12 files changed, 115 insertions, 160 deletions
diff --git a/modules/nixos/common/console.nix b/modules/nixos/common/console.nix
index e280919..3491e37 100644
--- a/modules/nixos/common/console.nix
+++ b/modules/nixos/common/console.nix
@@ -3,6 +3,8 @@
   pkgs,
   ...
 }: {
+  stylix.targets.console.enable = false;
+
   console = {
     earlySetup = true;
     font = "${pkgs.terminus_font}/share/consolefonts/ter-v16b.psf.gz";
diff --git a/modules/nixos/common/default.nix b/modules/nixos/common/default.nix
index 54f8f51..4c192c9 100644
--- a/modules/nixos/common/default.nix
+++ b/modules/nixos/common/default.nix
@@ -12,6 +12,7 @@ _: {
     ./security.nix
     ./services.nix
     ./shell.nix
+    ./stylix.nix
     ./systemd.nix
     ./tmp.nix
     ./users.nix
diff --git a/modules/nixos/common/stylix.nix b/modules/nixos/common/stylix.nix
new file mode 100644
index 0000000..6249abf
--- /dev/null
+++ b/modules/nixos/common/stylix.nix
@@ -0,0 +1,37 @@
+{
+  config,
+  inputs,
+  lib,
+  ...
+}:
+with lib; {
+  imports = [inputs.stylix.nixosModules.stylix];
+
+  fonts = {
+    packages = mkAfter config.nixfiles.modules.common.stylix.fonts.extraPackages;
+
+    fontconfig.defaultFonts = {
+      serif = mkForce [
+        "Iosevka Etoile"
+        "Sarasa Gothic"
+        "Source Han Serif"
+        "Noto Serif"
+      ];
+      sansSerif = mkForce [
+        "Iosevka Aile"
+        "Sarasa Gothic"
+        "Source Han Sans"
+        "Noto Sans"
+      ];
+      monospace = mkForce [
+        "Iosevka"
+        "Sarasa Mono"
+        "Source Han Mono"
+        "Noto Sans Mono"
+      ];
+      emoji = mkForce [
+        "Noto Color Emoji"
+      ];
+    };
+  };
+}
diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix
index 93f0974..1a42517 100644
--- a/modules/nixos/default.nix
+++ b/modules/nixos/default.nix
@@ -15,7 +15,6 @@ _: {
     ./endlessh.nix
     ./fail2ban.nix
     ./firefox
-    ./fonts.nix
     ./games
     ./git
     ./gnupg.nix
diff --git a/modules/nixos/dwm.nix b/modules/nixos/dwm.nix
index 9c5e283..a32ed29 100644
--- a/modules/nixos/dwm.nix
+++ b/modules/nixos/dwm.nix
@@ -18,8 +18,7 @@ in {
       windowManager.command = let
         pkg = pkgs.dwm.override {
           conf = let
-            font = with config.fontScheme.monospaceFont; "${family}:size=${toString size}";
-            colour = config.colourScheme;
+            font = with config.stylix.fonts; "${monospace.name}:size=${toString sizes.terminal}";
           in ''
             static const unsigned int borderpx = 1;
             static const unsigned int snap = 32;
@@ -32,14 +31,14 @@ in {
 
             static const char *colors[][3] = {
               [SchemeNorm] = {
-                "${colour.white}",
-                "${colour.black}",
-                "${colour.black}",
+                "${config.color.base06}",
+                "${config.color.base01}",
+                "${config.color.base01}",
               },
               [SchemeSel] = {
-                "${colour.black}",
-                "${colour.white}",
-                "${colour.white}",
+                "${config.color.base01}",
+                "${config.color.base06}",
+                "${config.color.base06}",
               },
             };
 
@@ -82,10 +81,10 @@ in {
               "${pkgs.dmenu}/bin/dmenu_run",
               "-m", dmenumon,
               "-fn", "${font}",
-              "-nb", "${colour.black}",
-              "-nf", "${colour.white}",
-              "-sb", "${colour.white}",
-              "-sf", "${colour.black}",
+              "-nb", "${config.color.base01}",
+              "-nf", "${config.color.base06}",
+              "-sb", "${config.color.base06}",
+              "-sf", "${config.color.base01}",
               NULL,
             };
             static const char *termcmd[] = {
diff --git a/modules/nixos/firefox/default.nix b/modules/nixos/firefox/default.nix
index ce8b3ee..d192ae1 100644
--- a/modules/nixos/firefox/default.nix
+++ b/modules/nixos/firefox/default.nix
@@ -22,6 +22,11 @@ in {
 
       home.packages = with pkgs; [profile-cleaner];
 
+      stylix.targets.firefox = {
+        enable = true;
+        profileNames = ["default"];
+      };
+
       programs.firefox = {
         enable = true;
 
@@ -32,34 +37,34 @@ in {
         profiles.default = let
           mkCssWithRoot = css:
             mkMerge [
-              (with config.colourScheme; ''
+              (with config.colors.withHashtag; ''
                 :root {
-                  --black: ${black};
-                  --red: ${red};
-                  --green: ${green};
-                  --yellow: ${yellow};
-                  --blue: ${blue};
-                  --magenta: ${magenta};
-                  --cyan: ${cyan};
-                  --white: ${white};
-                  --bright-black: ${brightBlack};
-                  --bright-red: ${brightRed};
-                  --bright-green: ${brightGreen};
-                  --bright-yellow: ${brightYellow};
-                  --bright-blue: ${brightBlue};
-                  --bright-magenta: ${brightMagenta};
-                  --bright-cyan: ${brightCyan};
-                  --bright-white: ${brightWhite};
-                  --background: ${background};
-                  --foreground: ${foreground};
+                  --black: ${base01};
+                  --red: ${base08};
+                  --green: ${base0B};
+                  --yellow: ${base09};
+                  --blue: ${base0D};
+                  --magenta: ${base0E};
+                  --cyan: ${base0C};
+                  --white: ${base06};
+                  --bright-black: ${base02};
+                  --bright-red: ${base12};
+                  --bright-green: ${base14};
+                  --bright-yellow: ${base13};
+                  --bright-blue: ${base16};
+                  --bright-magenta: ${base17};
+                  --bright-cyan: ${base15};
+                  --bright-white: ${base07};
+                  --background: ${base00};
+                  --foreground: ${base02};
               '')
-              (with config.fontScheme; ''
-                  --sans-serif-font-family: "${sansSerifFont.family}", "${sansSerifFontFallback.family}", sans-serif;
-                  --sans-serif-font-size: ${toString sansSerifFont.size}px;
-                  --serif-font-family: "${serifFont.family}", "${serifFontFallback.family}", serif;
-                  --serif-font-size: ${toString serifFont.size}px;
-                  --monospace-font-family: "${monospaceFont.family}", "${monospaceFontFallback.family}", monospace;
-                  --monospace-font-size: ${toString monospaceFont.size}px;
+              (with config.stylix.fonts; ''
+                  --sans-serif-font-family: "${sansSerif.name}", sans-serif;
+                  --sans-serif-font-size: ${toString sizes.applications};
+                  --serif-font-family: "${serif.name}", serif;
+                  --serif-font-size: ${toString sizes.applications};
+                  --monospace-font-family: "${monospace.name}", monospace;
+                  --monospace-font-size: ${toString sizes.applications};
                 }
               '')
               (builtins.readFile css)
diff --git a/modules/nixos/fonts.nix b/modules/nixos/fonts.nix
deleted file mode 100644
index a333cb3..0000000
--- a/modules/nixos/fonts.nix
+++ /dev/null
@@ -1,78 +0,0 @@
-{
-  config,
-  lib,
-  pkgs,
-  ...
-}:
-with lib; let
-  cfg = config.nixfiles.modules.fonts;
-in {
-  config = mkMerge [
-    (mkIf cfg.enable {
-      nixfiles.modules.common.nix.allowedUnfreePackages = ["symbola"];
-      hm.fonts.fontconfig.enable = true;
-      fonts = {
-        packages =
-          cfg.packages
-          ++ (with pkgs; [
-            noto-fonts-emoji
-            twitter-color-emoji
-            symbola
-          ]);
-
-        fontconfig = {
-          enable = true;
-
-          defaultFonts = {
-            emoji = mkForce [
-              "Twitter Color Emoji"
-              "Noto Color Emoji"
-              "Symbola"
-            ];
-            monospace = mkForce [
-              "Iosevka"
-              "Sarasa Mono"
-              "Source Han Mono"
-              "Noto Sans Mono"
-            ];
-            sansSerif = mkForce [
-              "Iosevka Aile"
-              "Sarasa Gothic"
-              "Source Han Sans"
-              "Noto Sans"
-            ];
-            serif = mkForce [
-              "Iosevka Etoile"
-              "Sarasa Gothic"
-              "Source Han Serif"
-              "Noto Serif"
-            ];
-          };
-
-          localConf = ''
-            <?xml version='1.0'?>
-            <!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
-            <fontconfig>
-              <alias binding="same">
-                <family>Helvetica</family>
-                <prefer>
-                  <family>sans-serif</family>
-                </prefer>
-              </alias>
-              <alias binding="same">
-                <family>Arial</family>
-                <prefer>
-                  <family>sans-serif</family>
-                </prefer>
-              </alias>
-            </fontconfig>
-          '';
-        };
-      };
-    })
-    (mkIf (!cfg.enable) {
-      hm.fonts.fontconfig.enable = false;
-      fonts.fontconfig.enable = false;
-    })
-  ];
-}
diff --git a/modules/nixos/git/default.nix b/modules/nixos/git/default.nix
index adff240..cbeb48a 100644
--- a/modules/nixos/git/default.nix
+++ b/modules/nixos/git/default.nix
@@ -93,7 +93,7 @@ in {
               @import url("cgit.css");
 
               div#cgit {
-                font-family: "${config.fontScheme.monospaceFont.family}", monospace;
+                font-family: monospace;
                 -moz-tab-size: 4;
                 tab-size: 4;
               }
diff --git a/modules/nixos/kde.nix b/modules/nixos/kde.nix
index 58990f1..3822415 100644
--- a/modules/nixos/kde.nix
+++ b/modules/nixos/kde.nix
@@ -18,12 +18,29 @@ in {
     };
 
     hm = {
-      home.sessionVariables.GTK_USE_PORTAL = 1;
-
       programs.firefox.profiles.default.settings = {
         "widget.use-xdg-desktop-portal.file-picker" = 1;
         "widget.use-xdg-desktop-portal.mime-handler" = 1;
       };
+
+      gtk.theme = {
+        package = mkForce pkgs.breeze-gtk;
+        name = mkForce "Breeze";
+      };
+
+      xdg.configFile = {
+        "fontconfig/conf.d/10-hm-fonts.conf".force = mkForce true;
+        "mimeapps.list".force = mkForce true;
+        "kcminputrc".text = generators.toINI {} {
+          Keyboard = with config.services.xserver; {
+            RepeatDelay = autoRepeatDelay;
+            RepeatRate = autoRepeatInterval;
+          };
+        };
+        "baloofilerc".text = generators.toINI {} {
+          "Basic Settings"."Indexing-Enabled" = false;
+        };
+      };
     };
 
     services.xserver = {
diff --git a/modules/nixos/profiles/headful.nix b/modules/nixos/profiles/headful.nix
index 187c5a3..4bc7ed3 100644
--- a/modules/nixos/profiles/headful.nix
+++ b/modules/nixos/profiles/headful.nix
@@ -74,7 +74,6 @@ in {
 
     services = {
       upower.enable = true;
-
       psd.enable = true;
     };
 
diff --git a/modules/nixos/thunderbird.nix b/modules/nixos/thunderbird.nix
index b5f360a..d8ce4ad 100644
--- a/modules/nixos/thunderbird.nix
+++ b/modules/nixos/thunderbird.nix
@@ -24,11 +24,11 @@ in {
           config.hm.programs.firefox.profiles.default.settings
           // {
             "app.donation.eoy.version.viewed" = 999;
-            "browser.display.background_color" = config.colourScheme.black;
-            "browser.display.background_color.dark" = config.colourScheme.black;
+            "browser.display.background_color" = config.colors.withHashtag.base00;
+            "browser.display.background_color.dark" = config.colors.withHashtag.base00;
             "browser.display.document_color_use" = 2;
-            "browser.display.foreground_color" = config.colourScheme.white;
-            "browser.display.foreground_color.dark" = config.colourScheme.white;
+            "browser.display.foreground_color" = config.colors.withHashtag.base07;
+            "browser.display.foreground_color.dark" = config.colors.withHashtag.base07;
             "javascript.enabled" = false;
             "mail.chat.enabled" = false;
             "mail.cloud_files.enabled" = false;
diff --git a/modules/nixos/x11.nix b/modules/nixos/x11.nix
index b629aeb..bd35d87 100644
--- a/modules/nixos/x11.nix
+++ b/modules/nixos/x11.nix
@@ -25,40 +25,14 @@ in {
         XCOMPOSECACHE = "${config.dirs.cache}/libx11/compose";
       };
 
-      xresources.properties =
-        (let
-          font = with config.fontScheme.monospaceFont; "${family}:style=${style}:size=${toString size}";
-        in {
-          "*.font" = font;
-
-          "Xft.antialias" = mkDefault 1;
-          "Xft.autohint" = mkDefault 0;
-          "Xft.hinting" = mkDefault 1;
-          "Xft.hintstyle" = mkDefault "hintslight";
-          "Xft.lcdfilter" = mkDefault "lcddefault";
-          "Xft.rgba" = mkDefault "rgb";
-        })
-        // (with config.colourScheme; {
-          "*.color0" = black;
-          "*.color8" = brightBlack;
-          "*.color1" = red;
-          "*.color9" = brightRed;
-          "*.color2" = green;
-          "*.color10" = brightGreen;
-          "*.color3" = yellow;
-          "*.color11" = brightYellow;
-          "*.color4" = blue;
-          "*.color12" = brightBlue;
-          "*.color5" = magenta;
-          "*.color13" = brightMagenta;
-          "*.color6" = cyan;
-          "*.color14" = brightCyan;
-          "*.color7" = white;
-          "*.color15" = brightWhite;
-
-          "*.background" = background;
-          "*.foreground" = foreground;
-        });
+      xresources.properties = {
+        "Xft.antialias" = mkDefault 1;
+        "Xft.autohint" = mkDefault 0;
+        "Xft.hinting" = mkDefault 1;
+        "Xft.hintstyle" = mkDefault "hintslight";
+        "Xft.lcdfilter" = mkDefault "lcddefault";
+        "Xft.rgba" = mkDefault "rgb";
+      };
 
       services.xsettingsd = {
         enable = true;
@@ -87,7 +61,7 @@ in {
       tty = mkDefault 1;
 
       autoRepeatDelay = 200;
-      autoRepeatInterval = 25;
+      autoRepeatInterval = 50;
 
       libinput.enable = true;
 

Consider giving Nix/NixOS a try! <3