@@ -7,62 +7,36 @@ import ./make-test-python.nix (
7
7
maintainers = [ schnusch ] ;
8
8
} ;
9
9
10
- nodes = {
11
- machine =
12
- { ... } :
13
- {
14
- users . users = {
15
- alice . isNormalUser = true ;
16
- bob . isNormalUser = true ;
17
- } ;
18
-
19
- systemd . user . tmpfiles = {
20
- rules = [
21
- "d %h/user_tmpfiles_created"
22
- ] ;
23
- users . alice . rules = [
24
- "d %h/only_alice"
25
- ] ;
26
- users . bob . rules = [
27
- "D %h/cleaned_up - - - 0"
28
- ] ;
29
- } ;
30
-
31
- # run every 10 seconds
32
- systemd . user . timers . systemd-tmpfiles-clean = {
33
- wantedBy = [ "timers.target" ] ;
34
- timerConfig = {
35
- OnStartupSec = "10s" ;
36
- OnUnitActiveSec = "10s" ;
37
- } ;
38
- } ;
10
+ nodes . machine =
11
+ { ... } :
12
+ {
13
+ users . users = {
14
+ alice . isNormalUser = true ;
15
+ bob . isNormalUser = true ;
39
16
} ;
40
17
41
- default =
42
- { ... } :
43
- {
44
- users . users = {
45
- alice . isNormalUser = true ;
46
- } ;
18
+ systemd . user . tmpfiles = {
19
+ rules = [
20
+ "d %h/user_tmpfiles_created"
21
+ ] ;
22
+ users . alice . rules = [
23
+ "d %h/only_alice"
24
+ ] ;
25
+ users . bob . rules = [
26
+ "D %h/cleaned_up - - - 0"
27
+ ] ;
28
+ } ;
47
29
48
- systemd . user . tmpfiles = {
49
- rules = [
50
- "d %h/user_tmpfiles_created"
51
- ] ;
52
- } ;
30
+ # run every 10 seconds
31
+ systemd . user . timers . systemd-tmpfiles-clean . timerConfig = {
32
+ OnStartupSec = "10s" ;
33
+ OnUnitActiveSec = "10s" ;
53
34
} ;
54
- } ;
35
+ } ;
55
36
56
37
testScript =
57
38
{ ... } :
58
39
''
59
- # Test if `systemd-tmpfiles-clean.timer` is not enabled if we do not change
60
- # anything below `systemd.user.timers.systemd-tmpfiles-clean`.
61
- default.succeed("loginctl enable-linger alice")
62
- default.wait_until_succeeds("systemctl --user --machine=alice@ is-active systemd-tmpfiles-setup.service")
63
- default.fail("systemctl --user --machine=alice@ is-active systemd-tmpfiles-clean.timer")
64
-
65
- # test user-tmpfiles.d
66
40
machine.succeed("loginctl enable-linger alice bob")
67
41
68
42
machine.wait_until_succeeds("systemctl --user --machine=alice@ is-active systemd-tmpfiles-setup.service")
@@ -74,11 +48,6 @@ import ./make-test-python.nix (
74
48
machine.succeed("[ ! -e ~bob/only_alice ]")
75
49
76
50
machine.succeed("systemctl --user --machine=bob@ is-active systemd-tmpfiles-clean.timer")
77
- machine.succeed(
78
- # we cannot combine `--machine=bob@` and `cat`
79
- # runuser -l does not set $XDG_RUNTIME_DIR
80
- 'runuser -u bob -- env XDG_RUNTIME_DIR="/run/user/$(id -u bob)" systemctl --user cat systemd-tmpfiles-clean.timer >&2'
81
- )
82
51
machine.succeed("runuser -u bob -- touch ~bob/cleaned_up/file")
83
52
machine.wait_until_fails("[ -e ~bob/cleaned_up/file ]")
84
53
'' ;
0 commit comments