mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-04 14:00:04 +00:00
linger-users: use systemd directory options
Using systemd properties avoids the need for manually running mkdir and cd commands, and helps systemd clean up properly when appropriate. Suggested-By: Grimmauld <grimmauld@grimmauld.de>
This commit is contained in:
@@ -899,7 +899,6 @@ in
|
||||
|
||||
script =
|
||||
let
|
||||
lingerDir = "/var/lib/systemd/linger";
|
||||
userPartition = lib.lists.partition (u: u.linger) (builtins.attrValues cfg.users);
|
||||
lingeringUserNames = map (u: u.name) userPartition.right;
|
||||
nonLingeringUserNames = map (u: u.name) userPartition.wrong;
|
||||
@@ -915,8 +914,6 @@ in
|
||||
id "$1" >/dev/null
|
||||
}
|
||||
|
||||
mkdir -vp ${lingerDir}
|
||||
cd ${lingerDir}
|
||||
shopt -s dotglob nullglob
|
||||
for user in *; do
|
||||
if ! user_configured "$user"; then
|
||||
@@ -934,7 +931,11 @@ in
|
||||
fi
|
||||
'';
|
||||
|
||||
serviceConfig.Type = "oneshot";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
StateDirectory = "systemd/linger";
|
||||
WorkingDirectory = "/var/lib/systemd/linger";
|
||||
};
|
||||
};
|
||||
|
||||
# Warn about user accounts with deprecated password hashing schemes
|
||||
|
||||
Reference in New Issue
Block a user