Commit 0ee02f5

HPCesia <me@hpcesia.com>
2025-10-08 18:07:24
feat: add and switch to niri
1 parent fd33c3a
modules/desktop/fonts/default.nix
@@ -33,8 +33,8 @@
   };
 
   flake.modules.homeManager.desktop = _: {
-    # allow fontconfig to discover fonts and configurations installed through home.packages
-    # Install fonts at system-level, not user-level
-    fonts.fontconfig.enable = false;
+    # Allow fontconfig to discover fonts and configurations installed through home.packages
+    # Needed if using niri-flake.
+    fonts.fontconfig.enable = true;
   };
 }
modules/desktop/shell/niri/default.nix
@@ -0,0 +1,26 @@
+{inputs, ...}: {
+  flake.modules.nixos.niri = {pkgs, ...}: {
+    imports = [inputs.niri-flake.nixosModules.niri];
+
+    niri-flake.cache.enable = false;
+
+    programs.niri = {
+      enable = true;
+    };
+  };
+
+  flake.modules.homeManager.niri = _: {
+    imports = [
+      inputs.dankMaterialShell.homeModules.dankMaterialShell.default
+      inputs.dankMaterialShell.homeModules.dankMaterialShell.niri
+    ];
+
+    programs.dankMaterialShell = {
+      enable = true;
+      niri = {
+        enableKeybinds = true;
+        enableSpawn = true;
+      };
+    };
+  };
+}
modules/desktop/shell/niri/greeter.nix
@@ -0,0 +1,20 @@
+{
+  flake.modules.nixos.niri = {pkgs, ...}: {
+    programs.regreet = {
+      enable = true;
+      font.size = 22;
+      theme = {
+        package = pkgs.catppuccin-gtk.override {
+          variant = "macchiato";
+          size = "compact";
+          accents = ["mauve"];
+        };
+        name = "catppuccin-macchiato-mauve-compact";
+      };
+      cursorTheme = {
+        package = pkgs.bibata-cursors;
+        name = "Bibata-Modern-Classic";
+      };
+    };
+  };
+}
modules/desktop/shell/niri/keybinding.nix
@@ -0,0 +1,45 @@
+{
+  flake.modules.homeManager.niri = {config, ...}: {
+    programs.niri.settings.binds = with config.lib.niri.actions; {
+      # Mod-Shift-/, which is usually the same as Mod-?,
+      # shows a list of important hotkeys.
+      "Mod+Shift+Slash".action = show-hotkey-overlay;
+
+      # Programs hotkey
+      "Mod+Grave".action = spawn "ghostty";
+
+      "Mod+Q".action = close-window;
+
+      # Focus
+      "Mod+H".action = focus-column-left;
+      "Mod+J".action = focus-window-down;
+      "Mod+K".action = focus-window-up;
+      "Mod+L".action = focus-column-right;
+      "Mod+Left".action = focus-column-left;
+      "Mod+Down".action = focus-window-down;
+      "Mod+Up".action = focus-window-up;
+      "Mod+Right".action = focus-column-right;
+      "Mod+Home".action = focus-column-first;
+      "Mod+End".action = focus-column-last;
+
+      # Move
+      "Mod+Ctrl+H".action = move-column-left;
+      "Mod+Ctrl+J".action = move-window-down;
+      "Mod+Ctrl+K".action = move-window-up;
+      "Mod+Ctrl+L".action = move-column-right;
+      "Mod+Ctrl+Left".action = move-column-left;
+      "Mod+Ctrl+Down".action = move-window-down;
+      "Mod+Ctrl+Up".action = move-window-up;
+      "Mod+Ctrl+Right".action = move-column-right;
+      "Mod+Ctrl+Home".action = move-column-to-first;
+      "Mod+Ctrl+End".action = move-column-to-last;
+
+      # Resize
+      "Mod+Minus".action = set-column-width "-10%";
+      "Mod+Equal".action = set-column-width "+10%";
+
+      "Mod+Shift+Minus".action = set-window-height "-10%";
+      "Mod+Shift+Equal".action = set-window-height "+10%";
+    };
+  };
+}
modules/desktop/shell/niri/options.nix
@@ -0,0 +1,60 @@
+{lib, ...}: {
+  flake.modules.homeManager.niri = {
+    config,
+    pkgs,
+    ...
+  }: let
+    inherit (lib) types mkOption;
+    format = pkgs.formats.json {};
+    cfg = config.programs.dankMaterialShell.settings;
+  in {
+    options.programs.dankMaterialShell.settings = mkOption {
+      type = types.nullOr (types.submodule {
+        freeformType = format.type;
+      });
+      default = null;
+    };
+
+    config = {
+      systemd.user.services.dank-material-shell-setup = lib.mkIf (cfg != null) {
+        Unit = {
+          Description = "DankMaterialShell Setup service";
+          After = ["graphical-session-pre.target"];
+          Wants = ["graphical-session-pre.target"];
+        };
+        Install.WantedBy = ["graphical-session.target"];
+        Service = {
+          Type = "oneshot";
+          UMask = "0022";
+          ExecStart = lib.getExe (pkgs.writeShellApplication {
+            name = "dms-setup";
+            runtimeInputs = with pkgs; [jq];
+            text = let
+              configPath = "${config.xdg.configHome}/DankMaterialShell/settings.json";
+            in ''
+              set -eu
+
+              TARGET_FILE="${configPath}"
+              TARGET_DIR=$(dirname "$TARGET_FILE")
+              NEW_JSON='${builtins.toJSON cfg}'
+
+              mkdir -p "$TARGET_DIR"
+
+              if [ -f "$TARGET_FILE" ]; then
+                echo "Merging config into existing file: $TARGET_FILE"
+                TEMP_FILE=$(mktemp)
+                jq --slurp '.[0] * .[1]' "$TARGET_FILE" <(echo "$NEW_JSON") > "$TEMP_FILE"
+                mv "$TEMP_FILE" "$TARGET_FILE"
+              else
+                echo "$TARGET_FILE not found. Creating new..."
+                echo "$NEW_JSON" > "$TARGET_FILE"
+              fi
+
+              echo "Config merge complete."
+            '';
+          });
+        };
+      };
+    };
+  };
+}
modules/desktop/shell/niri/secret-store.nix
@@ -0,0 +1,9 @@
+{
+  flake.modules.nixos.niri = _: {
+    services.gnome.gnome-keyring = {
+      enable = true;
+    };
+
+    security.pam.services.hpcesia.enableGnomeKeyring = true;
+  };
+}
modules/desktop/shell/niri/theme.nix
@@ -0,0 +1,20 @@
+{
+  flake.modules.homeManager.niri = {pkgs, ...}: {
+    gtk = {
+      enable = true;
+      theme = {
+        name = "Colloid";
+        package = pkgs.colloid-gtk-theme;
+      };
+    };
+
+    catppuccin.kvantum.enable = false;
+    qt = {
+      enable = true;
+      platformTheme = {
+        name = "qt6ct";
+        package = pkgs.kdePackages.qt6ct;
+      };
+    };
+  };
+}
modules/desktop/shell/default.nix
@@ -2,13 +2,15 @@
   # Import manually to switch desktop environment.
   flake.modules.nixos.desktop = {
     imports = with config.flake.modules.nixos; [
-      plasma6
+      # plasma6
+      niri
     ];
   };
 
   flake.modules.homeManager.desktop = {
     imports = with config.flake.modules.homeManager; [
-      plasma6
+      # plasma6
+      niri
     ];
   };
 }
modules/desktop/catppuccin.nix
@@ -5,7 +5,7 @@
     catppuccin = {
       enable = true;
       flavor = "macchiato";
-      accent = "mauve";
+      accent = "teal";
     };
 
     catppuccin.tty.enable = false;
@@ -17,7 +17,7 @@
     catppuccin = {
       enable = true;
       flavor = "macchiato";
-      accent = "mauve";
+      accent = "teal";
     };
   };
 }
modules/desktop/utils.nix
@@ -1,7 +1,8 @@
 {
-  flake.modules.nixos.desktop = _: {
+  flake.modules.nixos.desktop = {config, ...}: {
     services.gvfs.enable = true; # Mount, trash, and other functionalities
     services.tumbler.enable = true; # Thumbnail support for images
     services.xserver.xkb.layout = "us";
+    services.blueman.enable = config.hardware.bluetooth.enable;
   };
 }
flake.lock
@@ -33,6 +33,29 @@
         "type": "github"
       }
     },
+    "dankMaterialShell": {
+      "inputs": {
+        "dgop": "dgop",
+        "dms-cli": "dms-cli",
+        "nixpkgs": [
+          "nixpkgs"
+        ],
+        "quickshell": "quickshell"
+      },
+      "locked": {
+        "lastModified": 1759962526,
+        "narHash": "sha256-jRPr6BgtFa7fYTpuQjKDxHnmC4rEMLBanUwFBlnYEsw=",
+        "owner": "AvengeMedia",
+        "repo": "DankMaterialShell",
+        "rev": "6565988952a4b06775f845cae377c036589a0d9a",
+        "type": "github"
+      },
+      "original": {
+        "owner": "AvengeMedia",
+        "repo": "DankMaterialShell",
+        "type": "github"
+      }
+    },
     "deploy-rs": {
       "inputs": {
         "flake-compat": "flake-compat",
@@ -55,6 +78,27 @@
         "type": "github"
       }
     },
+    "dgop": {
+      "inputs": {
+        "nixpkgs": [
+          "dankMaterialShell",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1759769087,
+        "narHash": "sha256-b4dEAjvIfIkw2/C47aZGDnwhTBEjqptDo8J5PizeTCo=",
+        "owner": "AvengeMedia",
+        "repo": "dgop",
+        "rev": "ad6ad285e8b882c41eb8994ef7c91e151afb9a97",
+        "type": "github"
+      },
+      "original": {
+        "owner": "AvengeMedia",
+        "repo": "dgop",
+        "type": "github"
+      }
+    },
     "disko": {
       "inputs": {
         "nixpkgs": [
@@ -95,6 +139,27 @@
         "type": "github"
       }
     },
+    "dms-cli": {
+      "inputs": {
+        "nixpkgs": [
+          "dankMaterialShell",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1759946376,
+        "narHash": "sha256-/kQpJPH1y+U6V7N3bbGzvNRGfk9VuxdZev9Os4bS5ZQ=",
+        "owner": "AvengeMedia",
+        "repo": "danklinux",
+        "rev": "98db89ffba290265bc4a886d13b8a27a53fdaca1",
+        "type": "github"
+      },
+      "original": {
+        "owner": "AvengeMedia",
+        "repo": "danklinux",
+        "type": "github"
+      }
+    },
     "flake-compat": {
       "flake": false,
       "locked": {
@@ -283,6 +348,64 @@
         "type": "github"
       }
     },
+    "niri-flake": {
+      "inputs": {
+        "niri-stable": "niri-stable",
+        "niri-unstable": "niri-unstable",
+        "nixpkgs": [
+          "nixpkgs"
+        ],
+        "nixpkgs-stable": "nixpkgs-stable",
+        "xwayland-satellite-stable": "xwayland-satellite-stable",
+        "xwayland-satellite-unstable": "xwayland-satellite-unstable"
+      },
+      "locked": {
+        "lastModified": 1759909257,
+        "narHash": "sha256-ZGEBkK8ZQ370ifJO+1TOQ87m9Gmj52uzqcqysd/lolI=",
+        "owner": "sodiboo",
+        "repo": "niri-flake",
+        "rev": "0d12957ebc8e272e3fc3830549edbb1ad63c34d4",
+        "type": "github"
+      },
+      "original": {
+        "owner": "sodiboo",
+        "repo": "niri-flake",
+        "type": "github"
+      }
+    },
+    "niri-stable": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1756556321,
+        "narHash": "sha256-RLD89dfjN0RVO86C/Mot0T7aduCygPGaYbog566F0Qo=",
+        "owner": "YaLTeR",
+        "repo": "niri",
+        "rev": "01be0e65f4eb91a9cd624ac0b76aaeab765c7294",
+        "type": "github"
+      },
+      "original": {
+        "owner": "YaLTeR",
+        "ref": "v25.08",
+        "repo": "niri",
+        "type": "github"
+      }
+    },
+    "niri-unstable": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1759395653,
+        "narHash": "sha256-sv9J1z6CrTPf9lRJLyCN90fZVdQz7LFeX7pIlInH8BQ=",
+        "owner": "YaLTeR",
+        "repo": "niri",
+        "rev": "ba6e5e082a79901dc89b0d49c5da1b769d652aec",
+        "type": "github"
+      },
+      "original": {
+        "owner": "YaLTeR",
+        "repo": "niri",
+        "type": "github"
+      }
+    },
     "nixos-hardware": {
       "locked": {
         "lastModified": 1759582739,
@@ -347,6 +470,22 @@
       }
     },
     "nixpkgs-stable": {
+      "locked": {
+        "lastModified": 1759735786,
+        "narHash": "sha256-a0+h02lyP2KwSNrZz4wLJTu9ikujNsTWIC874Bv7IJ0=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "20c4598c84a671783f741e02bf05cbfaf4907cff",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixos-25.05",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "nixpkgs-stable_2": {
       "locked": {
         "lastModified": 1759580034,
         "narHash": "sha256-YWo57PL7mGZU7D4WeKFMiW4ex/O6ZolUS6UNBHTZfkI=",
@@ -518,9 +657,31 @@
         "type": "github"
       }
     },
+    "quickshell": {
+      "inputs": {
+        "nixpkgs": [
+          "dankMaterialShell",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1759610621,
+        "narHash": "sha256-P3UPFd95mS/3aNgy40nCXAmyfR2bEEBd+tX6xfkYFb0=",
+        "ref": "refs/heads/master",
+        "rev": "c5c438f1cd1a76660a8658ef929a3d19e968e2ce",
+        "revCount": 689,
+        "type": "git",
+        "url": "https://git.outfoxxed.me/quickshell/quickshell"
+      },
+      "original": {
+        "type": "git",
+        "url": "https://git.outfoxxed.me/quickshell/quickshell"
+      }
+    },
     "root": {
       "inputs": {
         "catppuccin": "catppuccin",
+        "dankMaterialShell": "dankMaterialShell",
         "deploy-rs": "deploy-rs",
         "disko": "disko",
         "distro-grub-themes": "distro-grub-themes",
@@ -528,10 +689,11 @@
         "helix-fork": "helix-fork",
         "home-manager": "home-manager",
         "import-tree": "import-tree",
+        "niri-flake": "niri-flake",
         "nixos-hardware": "nixos-hardware",
         "nixos-logo": "nixos-logo",
         "nixpkgs": "nixpkgs_3",
-        "nixpkgs-stable": "nixpkgs-stable",
+        "nixpkgs-stable": "nixpkgs-stable_2",
         "nixpkgs-unstable": "nixpkgs-unstable",
         "nur": "nur",
         "nur-hpcesia": "nur-hpcesia",
@@ -706,6 +868,39 @@
         "repo": "Wallpapers",
         "type": "github"
       }
+    },
+    "xwayland-satellite-stable": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1755491097,
+        "narHash": "sha256-m+9tUfsmBeF2Gn4HWa6vSITZ4Gz1eA1F5Kh62B0N4oE=",
+        "owner": "Supreeeme",
+        "repo": "xwayland-satellite",
+        "rev": "388d291e82ffbc73be18169d39470f340707edaa",
+        "type": "github"
+      },
+      "original": {
+        "owner": "Supreeeme",
+        "ref": "v0.7",
+        "repo": "xwayland-satellite",
+        "type": "github"
+      }
+    },
+    "xwayland-satellite-unstable": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1759707084,
+        "narHash": "sha256-0pkftKs6/LReNvxw7DVTN2AJEheZVgyeK0Aarbagi70=",
+        "owner": "Supreeeme",
+        "repo": "xwayland-satellite",
+        "rev": "a9188e70bd748118b4d56a529871b9de5adb9988",
+        "type": "github"
+      },
+      "original": {
+        "owner": "Supreeeme",
+        "repo": "xwayland-satellite",
+        "type": "github"
+      }
     }
   },
   "root": "root",
flake.nix
@@ -4,6 +4,9 @@
   inputs = {
     catppuccin.url = "github:catppuccin/nix";
 
+    dankMaterialShell.url = "github:AvengeMedia/DankMaterialShell";
+    dankMaterialShell.inputs.nixpkgs.follows = "nixpkgs";
+
     deploy-rs.url = "github:serokell/deploy-rs";
     deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
 
@@ -23,6 +26,9 @@
 
     import-tree.url = "github:vic/import-tree";
 
+    niri-flake.url = "github:sodiboo/niri-flake";
+    niri-flake.inputs.nixpkgs.follows = "nixpkgs";
+
     nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
     nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
     nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-25.05";