about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authormaxine <35892750+amaxine@users.noreply.github.com>2024-03-08 09:54:44 +0000
committerGitHub <noreply@github.com>2024-03-08 09:54:44 +0000
commitb587c07865dcf74940653fc237a273adb6388a1f (patch)
tree1fe02829a6dadfcf2541084191b32f2ba05e12fe /nixos/modules
parente65193c59a67e5c3cce061ad86786701c7ff962a (diff)
parent8558d7b1ceb604b4e91b17281f2efbbad5ba47a1 (diff)
downloadnixlib-b587c07865dcf74940653fc237a273adb6388a1f.tar
nixlib-b587c07865dcf74940653fc237a273adb6388a1f.tar.gz
nixlib-b587c07865dcf74940653fc237a273adb6388a1f.tar.bz2
nixlib-b587c07865dcf74940653fc237a273adb6388a1f.tar.lz
nixlib-b587c07865dcf74940653fc237a273adb6388a1f.tar.xz
nixlib-b587c07865dcf74940653fc237a273adb6388a1f.tar.zst
nixlib-b587c07865dcf74940653fc237a273adb6388a1f.zip
Merge pull request #292847 from jwillikers/linger-hotfix
Fix the update-lingering activation script to not fail when a user is removed
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/config/users-groups.nix5
1 files changed, 5 insertions, 0 deletions
diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix
index dd34771c0b42..02cd1a17f538 100644
--- a/nixos/modules/config/users-groups.nix
+++ b/nixos/modules/config/users-groups.nix
@@ -704,6 +704,11 @@ in {
     in stringAfter [ "users" ] ''
       if [ -e ${lingerDir} ] ; then
         cd ${lingerDir}
+        for user in ${lingerDir}/*; do
+          if ! id "$user" >/dev/null 2>&1; then
+            rm --force -- "$user"
+          fi
+        done
         ls ${lingerDir} | sort | comm -3 -1 ${lingeringUsersFile} - | xargs -r ${pkgs.systemd}/bin/loginctl disable-linger
         ls ${lingerDir} | sort | comm -3 -2 ${lingeringUsersFile} - | xargs -r ${pkgs.systemd}/bin/loginctl  enable-linger
       fi