nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, ... }:
2{
3 name = "systemd-user-tmpfiles-rules";
4
5 meta = with lib.maintainers; {
6 maintainers = [ schnusch ];
7 };
8
9 nodes.machine =
10 { ... }:
11 {
12 users.users = {
13 alice.isNormalUser = true;
14 bob.isNormalUser = true;
15 };
16
17 systemd.user.tmpfiles = {
18 rules = [
19 "d %h/user_tmpfiles_created"
20 ];
21 users.alice.rules = [
22 "d %h/only_alice"
23 ];
24 };
25 };
26
27 testScript =
28 { ... }:
29 ''
30 machine.succeed("loginctl enable-linger alice bob")
31
32 machine.wait_until_succeeds("systemctl --user --machine=alice@ is-active systemd-tmpfiles-setup.service")
33 machine.succeed("[ -d ~alice/user_tmpfiles_created ]")
34 machine.succeed("[ -d ~alice/only_alice ]")
35
36 machine.wait_until_succeeds("systemctl --user --machine=bob@ is-active systemd-tmpfiles-setup.service")
37 machine.succeed("[ -d ~bob/user_tmpfiles_created ]")
38 machine.succeed("[ ! -e ~bob/only_alice ]")
39 '';
40}