Commit a5ee2b0

HPCesia <me@hpcesia.com>
2026-06-17 05:12:40
Add terminals config
1 parent c3e9701
Changed files (4)
modules
desktop
users
hpcesia
modules/desktop/terminal/default.nix
@@ -0,0 +1,24 @@
+{den, ...}: {
+  den.aspects.desktop.terminal = {
+    includes =
+      den.lib.policy.when
+      ({host, ...}: host.hasAspect den.aspects.desktop.env.wm.niri)
+      [den.aspects.desktop.terminal.integration.niri];
+
+    homeManager = {
+      xdg.terminal-exec.enable = true;
+    };
+
+    integration = {
+      niri = {
+        homeManager = {user, ...}: {
+          programs.niri.extraConfig.pre = {
+            binds = {
+              "Mod+Grave".spawn = user.system.settings.desktop.terminal.default;
+            };
+          };
+        };
+      };
+    };
+  };
+}
modules/desktop/terminal/foot.nix
@@ -0,0 +1,49 @@
+{
+  den,
+  lib,
+  ...
+}: {
+  den.aspects.desktop.terminal.foot = {
+    includes = [den.aspects.desktop.terminal];
+
+    homeManager = {
+      host,
+      user,
+      ...
+    }: let
+      fontsCfg = host.settings.desktop.style.fonts;
+    in {
+      xdg.terminal-exec.settings.default =
+        if (user.system.settings.desktop.terminal.default == "foot")
+        then lib.mkBefore ["foot.desktop"]
+        else lib.mkAfter ["foot.desktop"];
+
+      programs.foot = {
+        enable = true;
+        settings = {
+          main = {
+            pad = "10x10";
+            font = "${ (builtins.elemAt fontsCfg.monospace 0).name}:size=${toString fontsCfg.sizes.terminal}";
+            dpi-aware = "no";
+          };
+        };
+      };
+    };
+  };
+
+  den.aspects.desktop.terminal.foot.themes = {
+    catppuccin = {
+      homeManager = {pkgs, ...}: {
+        programs.foot = {
+          settings = {
+            main.include = "${pkgs.fetchurl {
+              pname = "foot-theme-catppuccin-mocha.ini";
+              url = "https://github.com/catppuccin/foot/raw/99384a83ee9246cd0a38aeee07d8300367724602/themes/static/catppuccin-mocha.ini";
+              hash = "sha256-LmWxEy/euVLqtjC/emb0R5LVb62q6OfvEc8Vkyc84BQ=";
+            }}";
+          };
+        };
+      };
+    };
+  };
+}
modules/desktop/terminal/ghostty.nix
@@ -0,0 +1,59 @@
+{
+  den,
+  lib,
+  ...
+}: {
+  den.aspects.desktop.terminal.ghostty = {
+    includes = [den.aspects.desktop.terminal];
+
+    homeManager = {
+      host,
+      user,
+      ...
+    }: let
+      fontsCfg = host.settings.desktop.style.fonts;
+    in {
+      xdg.terminal-exec.settings.default =
+        if (user.system.settings.desktop.terminal.default == "ghostty")
+        then lib.mkBefore ["com.mitchellh.ghostty.desktop"]
+        else lib.mkAfter ["com.mitchellh.ghostty.desktop"];
+
+      programs.ghostty = {
+        enable = true;
+        enableBashIntegration = true;
+        enableFishIntegration = true;
+
+        settings = {
+          font-family = lib.concatMap (f: f.name) (fontsCfg.monospace.name ++ fontsCfg.emoji.name);
+          font-size = fontsCfg.sizes.terminal;
+          window-padding-x = 5;
+          window-padding-y = 5;
+          window-padding-balance = true;
+        };
+      };
+    };
+  };
+
+  den.aspects.desktop.terminal.ghostty.themes = {
+    catppuccin = {
+      homeManager = {pkgs, ...}: {
+        xdg.configFile."ghostty/themes/catppuccin-latte.conf".source = pkgs.fetchurl {
+          pname = "ghostty-theme-catppuccin-latte.conf";
+          url = "https://github.com/catppuccin/ghostty/raw/5a58926563ddacbde4a12b4a347464c2c6945393/themes/catppuccin-latte.conf";
+          hash = "sha256-S+V2DXWakPAHpwyhgZrgmrHbDIScRi8/O0RZD1EQrvU=";
+        };
+        xdg.configFile."ghostty/themes/catppuccin-mocha.conf".source = pkgs.fetchurl {
+          pname = "ghostty-theme-catppuccin-mocha.conf";
+          url = "https://github.com/catppuccin/ghostty/raw/5a58926563ddacbde4a12b4a347464c2c6945393/themes/catppuccin-mocha.conf";
+          hash = "sha256-/NwPBF9o16h5f/Xx06dniLwX3VO0Z8Bbe9Zb0UoBMx4=";
+        };
+
+        programs.ghostty = {
+          settings = {
+            theme = "light:catppuccin-latte.conf,dark:catppuccin-mocha.conf";
+          };
+        };
+      };
+    };
+  };
+}
modules/users/hpcesia/default.nix
@@ -19,6 +19,7 @@
         (with den.aspects; [
           desktop.env.wm.niri
           desktop.gnupg
+          desktop.terminal.foot
         ]));
   };
 
@@ -42,6 +43,9 @@
     system = {
       hashedPasswordAged = ./hashed-password.age;
       themes.theme = "catppuccin";
+      settings = {
+        desktop.terminal.default = "foot";
+      };
     };
   };
 }