nixos/gdm: update gdm-greeter user homes

This fixes gdm not being able to save config changes made on the log-in
screen, such as turning on accessibility options. The new values for the
`gdm-greeter{-2,-3,-4,-5}` users map onto what userdbd would create for us.
We need writable home directories to interact with `dbus`, as well as to
populate the `/run/gdm/home/gdm-greeter/.config/environment.d/` files.

`gnome-inital-setup-done` is now seemingly called `gdm.ran-initial-setup`:
https://gitlab.gnome.org/GNOME/gdm/-/blob/gnome-50/daemon/gdm-manager.c?ref_type=heads#L64
This commit is contained in:
winston
2026-05-21 17:47:56 +02:00
parent bb23a160a1
commit 3fb5cf873d
+29 -28
View File
@@ -44,6 +44,20 @@ let
defaultSessionName = config.services.displayManager.defaultSession;
setSessionScript = pkgs.callPackage ../x11/display-managers/account-service-util.nix { };
greeterUsers = lib.genAttrs' [ null 1 2 3 4 ] (
i:
let
# adding 1 to create `gdm-greeter{-2,-3,-4,-5}`
suffix = lib.optionalString (i != null) "-${toString (i + 1)}";
in
lib.nameValuePair "gdm-greeter${suffix}" {
isSystemUser = true;
uid = 60578 + (if i == null then 0 else i);
group = "gdm";
home = "/run/gdm/home/gdm-greeter${suffix}";
}
);
in
{
@@ -196,24 +210,8 @@ in
group = "gdm";
description = "GDM user";
};
gdm-greeter = {
isSystemUser = true;
uid = 60578;
group = "gdm";
home = "/run/gdm";
};
}
(lib.genAttrs' [ 1 2 3 4 ] (
i:
lib.nameValuePair "gdm-greeter-${toString i}" {
isSystemUser = true;
uid = 60578 + i;
group = "gdm";
home = "/run/gdm-${toString i}";
}
))
greeterUsers
];
users.groups.gdm.gid = config.ids.gids.gdm;
@@ -255,17 +253,20 @@ in
};
};
systemd.tmpfiles.rules = [
"d /run/gdm/.config 0711 gdm gdm"
]
++ lib.optionals config.services.pulseaudio.enable [
"d /run/gdm/.config/pulse 0711 gdm gdm"
"L+ /run/gdm/.config/pulse/${pulseConfig.name} - - - - ${pulseConfig}"
]
++ lib.optionals config.services.gnome.gnome-initial-setup.enable [
# Create stamp file for gnome-initial-setup to prevent it starting in GDM.
"f /run/gdm/.config/gnome-initial-setup-done 0711 gdm gdm - yes"
];
systemd.tmpfiles.rules =
lib.optionals config.services.pulseaudio.enable (
lib.concatLists (
lib.mapAttrsToList (name: user: [
"d ${user.home}/.config 0711 ${name} gdm"
"d ${user.home}/.config/pulse 0711 ${name} gdm"
"L+ ${user.home}/.config/pulse/${pulseConfig.name} - - - - ${pulseConfig}"
]) greeterUsers
)
)
++ lib.optionals config.services.gnome.gnome-initial-setup.enable [
# Create stamp file for gnome-initial-setup to prevent it starting in GDM.
"f /run/gdm/gdm.ran-initial-setup 0711 gdm gdm - yes"
];
# Otherwise GDM will not be able to start correctly and display Wayland sessions
systemd.packages = [