nixos/niri: don't restart niri.service on switch

The packaged user unit bakes the niri store path into ExecStart, so
any rebuild of niri (including transitive dependency bumps) makes
switch-to-configuration restart it, killing the graphical session.

Mirror the display-manager modules and mark the unit
restartIfChanged = false. Disable the default PATH injection so the
generated drop-in does not override the environment imported by
niri-session.
This commit is contained in:
r-vdp
2026-05-13 12:10:25 +02:00
parent 29c8cdc8cd
commit 5c7bdcef03
+11
View File
@@ -40,6 +40,17 @@ in
systemd.packages = [ cfg.package ];
# Restarting the compositor kills the graphical session; same
# treatment as the display-manager modules.
systemd.user.services.niri = {
restartIfChanged = false;
# Defining the unit here generates a drop-in; without this it
# would carry the NixOS default Environment="PATH=coreutils:…",
# clobbering the PATH that niri-session imported into the user
# manager and breaking spawn actions that rely on it.
enableDefaultPath = false;
};
xdg.portal = {
enable = lib.mkDefault true;