mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
Remove optional builtins prefixes from prelude functions by running:
builtins=(
abort
baseNameOf
break
derivation
derivationStrict
dirOf
false
fetchGit
fetchMercurial
fetchTarball
fetchTree
fromTOML
import
isNull
map
null
placeholder
removeAttrs
scopedImport
throw
toString
true
)
fd \
--exclude doc/manual/release-notes \
--type file \
. \
nixos \
--exec-batch sed --in-place --regexp-extended "
s/\<builtins\.($(
printf '%s\n' "${builtins[@]}" |
paste --delimiter '|' --serial -
))\>/\1/g
"
nix fmt
37 lines
1.2 KiB
Nix
37 lines
1.2 KiB
Nix
# This test checks #418101, where lingering users would not be cleared up if
|
|
# the configuration is updated to remove lingering from all users.
|
|
rec {
|
|
name = "systemd-user-linger-purge";
|
|
|
|
nodes.machine = {
|
|
users.users = {
|
|
bob = {
|
|
isNormalUser = true;
|
|
linger = false;
|
|
uid = 1001;
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript =
|
|
let
|
|
uidStrings = builtins.mapAttrs (k: v: toString v.uid) nodes.machine.users.users;
|
|
in
|
|
''
|
|
machine.fail("test -e /var/lib/systemd/linger/bob")
|
|
machine.fail("systemctl status user-${uidStrings.bob}.slice")
|
|
|
|
with subtest("missing users have linger purged"):
|
|
machine.succeed("touch /var/lib/systemd/linger/alice")
|
|
machine.systemctl("restart linger-users")
|
|
machine.succeed("test ! -e /var/lib/systemd/linger/alice")
|
|
|
|
with subtest("mutable users can linger"):
|
|
machine.succeed("useradd alice")
|
|
machine.succeed("test ! -e /var/lib/systemd/linger/alice")
|
|
machine.succeed("loginctl enable-linger alice")
|
|
machine.succeed("test -e /var/lib/systemd/linger/alice")
|
|
machine.systemctl("restart linger-users")
|
|
machine.succeed("test -e /var/lib/systemd/linger/alice")
|
|
'';
|
|
}
|