GDM 50 falls back to launching `gnome-session` as the user session
command when the AccountsService record has `Session=` empty and
`services.displayManager.defaultSession` is unset. On a Niri-only
machine the spawn fails with ENOENT and the user is bounced back to
the greeter — an indefinite login loop after a fresh install or after
the AccountsService record gets reset.
GDM 49 hit the same fallback path but happened to find gnome-session
on PATH; the user's first session pick then got stashed in
AccountsService and subsequent logins worked. GDM 50's tighter
environment removed the accidental save.
Setting `services.displayManager.defaultSession = lib.mkDefault "niri"`
inside `programs.niri` makes a Niri-only install boot straight into
the compositor. Users running multiple session packages can still
override via a plain assignment.
Refs https://github.com/NixOS/nixpkgs/issues/523332
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.