Skip to content

Commit 622143b

Browse files
committed
feat(sddm): seed last-user state declaratively
SDDM only prefills the username from /var/lib/sddm/state.conf, which is written after a successful login — so the first login after a display-manager switch shows an empty username field. Seed the file from the host's khanelinix.user via a tmpfiles C rule (copy only when missing), leaving SDDM's own last-user tracking in charge afterward.
1 parent f2dd0ed commit 622143b

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

modules/nixos/display-managers/sddm/default.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ let
1414
userName = config.khanelinix.user.name;
1515

1616
themePackage = pkgs.catppuccin-sddm-corners;
17+
18+
# SDDM only prefills the username from state written after a successful
19+
# login; seed it so the very first login is already populated.
20+
seedStateFile = pkgs.writeText "sddm-state.conf" ''
21+
[Last]
22+
User=${userName}
23+
'';
1724
in
1825
{
1926
options.khanelinix.display-managers.sddm = {
@@ -49,6 +56,12 @@ in
4956
};
5057
};
5158

59+
# C = copy only when the destination is missing, so SDDM's own last-user
60+
# tracking still wins after the first login (C+ would force it every boot)
61+
systemd.tmpfiles.rules = [
62+
"C /var/lib/sddm/state.conf 0600 sddm sddm - ${seedStateFile}"
63+
];
64+
5265
system.activationScripts.postInstallSddm = stringAfter [ "users" ] /* Bash */ ''
5366
echo "Setting sddm permissions for user icon"
5467
${getExe' pkgs.acl "setfacl"} -m u:sddm:x /home/${userName}

0 commit comments

Comments
 (0)