nixos/gdm: use systemd tmpfiles instead of preStart

Thet was a mess before. This should be more reliable.
This commit is contained in:
worldofpeace 2019-12-12 09:04:58 -05:00
parent 6be14ee97b
commit 15a9c80c05

View file

@ -159,22 +159,21 @@ in
GDM_X_SESSION_WRAPPER = "${xSessionWrapper}"; GDM_X_SESSION_WRAPPER = "${xSessionWrapper}";
}; };
execCmd = "exec ${gdm}/bin/gdm"; execCmd = "exec ${gdm}/bin/gdm";
preStart = optionalString config.hardware.pulseaudio.enable '' preStart = optionalString (defaultSessionName != null) ''
mkdir -p /run/gdm/.config/pulse
ln -sf ${pulseConfig} /run/gdm/.config/pulse/default.pa
chown -R gdm:gdm /run/gdm/.config
'' + optionalString config.services.gnome3.gnome-initial-setup.enable ''
# Create stamp file for gnome-initial-setup to prevent run.
mkdir -p /run/gdm/.config
cat - > /run/gdm/.config/gnome-initial-setup-done <<- EOF
yes
EOF
'' + optionalString (defaultSessionName != null) ''
# Set default session in session chooser to a specified values basically ignore session history. # Set default session in session chooser to a specified values basically ignore session history.
${setSessionScript}/bin/set-session ${cfg.sessionData.autologinSession} ${setSessionScript}/bin/set-session ${cfg.sessionData.autologinSession}
''; '';
}; };
systemd.tmpfiles.rules = [
"d /run/gdm/.config 0711 gdm gdm -"
] ++ optionals config.hardware.pulseaudio.enable [
"L+ /run/gdm/.config/pulse - - - - ${pulseConfig}"
] ++ optionals config.services.gnome3.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.services.display-manager.wants = [ systemd.services.display-manager.wants = [
# Because sd_login_monitor_new requires /run/systemd/machines # Because sd_login_monitor_new requires /run/systemd/machines
"systemd-machined.service" "systemd-machined.service"