Merge pull request #251684 from jmbaur/user-activation-tmpfiles

nixos/systemd-user: call systemd-tmpfiles during activation
This commit is contained in:
Florian Klink 2023-09-01 21:52:19 +03:00 committed by GitHub
commit 90204f058c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -230,5 +230,9 @@ in {
});
})
cfg.tmpfiles.users;
system.userActivationScripts.tmpfiles = ''
${config.systemd.package}/bin/systemd-tmpfiles --user --create --remove
'';
};
}

View File

@ -8,6 +8,7 @@ import ./make-test-python.nix ({ lib, ... }: {
initialPassword = "pass1";
isNormalUser = true;
};
systemd.user.tmpfiles.users.alice.rules = [ "r %h/file-to-remove" ];
};
testScript = ''
@ -27,7 +28,9 @@ import ./make-test-python.nix ({ lib, ... }: {
machine.wait_for_file("/home/alice/login-ok")
verify_user_activation_run_count(1)
machine.succeed("touch /home/alice/file-to-remove")
machine.succeed("/run/current-system/bin/switch-to-configuration test")
verify_user_activation_run_count(2)
machine.succeed("[[ ! -f /home/alice/file-to-remove ]] || false")
'';
})