Commit 069f98c4736a

Vincent Demeester <vincent@sbr.pm>
2025-09-03 16:45:07
flake&systems: add niri-flake and small configuration
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent a9f5cfe
Changed files (4)
systems/common/desktop/niri.nix
@@ -3,6 +3,15 @@
   lib,
   ...
 }:
+let
+  niriRun = pkgs.writeShellScript "niri-run" ''
+    export XDG_SESSION_TYPE=wayland
+    export XDG_SESSION_DESKTOP=niri
+    export XDG_CURRENT_DESKTOP=niri
+
+    systemd-run --user --scope --collect --quiet --unit=niri systemd-cat --identifier=niri ${pkgs.niri}/bin/niri $@
+  '';
+in
 {
   imports = [
     ./tiling-common.nix
@@ -11,4 +20,22 @@
   programs.niri = {
     enable = true;
   };
+  # Allow swaylock to unlock the computer for us
+  security.pam.services.swaylock = {
+    text = "auth include login";
+  };
+
+  services.greetd.settings = {
+    default_session = {
+      # command = "${pkgs.greetd.greetd}/bin/agreety --cmd niri";
+      command = "${
+        lib.makeBinPath [ pkgs.greetd.tuigreet ]
+      }/tuigreet -r --asterisks --time --cmd ${niriRun}";
+      users = "greeter";
+    };
+    initial_session = {
+      command = "${niriRun}";
+      user = "vincent";
+    };
+  };
 }
systems/default.nix
@@ -10,16 +10,15 @@
 }:
 {
 
-  imports =
-    [
-      (./. + "/${hostname}/boot.nix")
-      (./. + "/${hostname}/hardware.nix")
+  imports = [
+    (./. + "/${hostname}/boot.nix")
+    (./. + "/${hostname}/hardware.nix")
 
-      ./common/base
-      ./common/users
-    ]
-    ++ lib.optional (builtins.pathExists (./. + "/${hostname}/extra.nix")) ./${hostname}/extra.nix
-    ++ lib.optional (builtins.isString desktop) ./common/desktop;
+    ./common/base
+    ./common/users
+  ]
+  ++ lib.optional (builtins.pathExists (./. + "/${hostname}/extra.nix")) ./${hostname}/extra.nix
+  ++ lib.optional (builtins.isString desktop) ./common/desktop;
 
   nixpkgs = {
     overlays = [
@@ -30,6 +29,7 @@
 
       # And from other flakes
       inputs.emacs-overlay.overlay
+      inputs.niri.overlays.niri
       inputs.chapeau-rouge.overlays.openshift
       inputs.chick-group.overlays.default
       inputs.agenix.overlays.default
flake.lock
@@ -589,6 +589,66 @@
         "type": "github"
       }
     },
+    "niri": {
+      "inputs": {
+        "niri-stable": "niri-stable",
+        "niri-unstable": "niri-unstable",
+        "nixpkgs": [
+          "nixpkgs"
+        ],
+        "nixpkgs-stable": [
+          "nixpkgs-25_05"
+        ],
+        "xwayland-satellite-stable": "xwayland-satellite-stable",
+        "xwayland-satellite-unstable": "xwayland-satellite-unstable"
+      },
+      "locked": {
+        "lastModified": 1756907248,
+        "narHash": "sha256-YQyug4zPtKLck1Aq3CPWy3AuH83riQRy00hsZLi22e0=",
+        "owner": "sodiboo",
+        "repo": "niri-flake",
+        "rev": "4c144345fffa3841072dbb083cea06e75201331d",
+        "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": 1756895668,
+        "narHash": "sha256-hgrDHt8dZXRvBiX/M5qevexN6w7yHslW/osNpqe6qBA=",
+        "owner": "YaLTeR",
+        "repo": "niri",
+        "rev": "0c5beaac40ea29752316a9eccccf2a640dfafc71",
+        "type": "github"
+      },
+      "original": {
+        "owner": "YaLTeR",
+        "repo": "niri",
+        "type": "github"
+      }
+    },
     "nix-github-actions": {
       "inputs": {
         "nixpkgs": [
@@ -955,6 +1015,7 @@
         "home-manager": "home-manager_3",
         "home-manager-25_05": "home-manager-25_05",
         "lanzaboote": "lanzaboote",
+        "niri": "niri",
         "nix-github-actions": "nix-github-actions_4",
         "nixos-generators": "nixos-generators",
         "nixos-hardware": "nixos-hardware",
@@ -1036,6 +1097,39 @@
         "repo": "default",
         "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": 1756869116,
+        "narHash": "sha256-SGcqX3amLH4xiA+dwF2Fu2mt1O8zHc60v0+NEZGDJhw=",
+        "owner": "Supreeeme",
+        "repo": "xwayland-satellite",
+        "rev": "41e865c8d35468c67b991ef5a245a98b3e44108c",
+        "type": "github"
+      },
+      "original": {
+        "owner": "Supreeeme",
+        "repo": "xwayland-satellite",
+        "type": "github"
+      }
     }
   },
   "root": "root",
flake.nix
@@ -56,7 +56,8 @@
         # Work laptop (unstable)
         kyushu = libx.mkHost {
           hostname = "kyushu";
-          desktop = "sway";
+          # desktop = "sway";
+          desktop = "niri";
         };
         # Test VM, name is..
         foobar = libx.mkHost {
@@ -320,8 +321,13 @@
       inputs.nixpkgs.follows = "nixpkgs-25_05";
     };
 
-    # FIXME could still be useful for servers
-    # impermanence = { type = "github"; owner = "nix-community"; repo = "impermanence"; };
+    niri = {
+      type = "github";
+      owner = "sodiboo";
+      repo = "niri-flake";
+      inputs.nixpkgs.follows = "nixpkgs";
+      inputs.nixpkgs-stable.follows = "nixpkgs-25_05";
+    };
 
     dagger = {
       type = "github";