Add option ‘systemd.tmpfiles.rules’

This allows specifying rules for systemd-tmpfiles.

Also, enable systemd-tmpfiles-clean.timer so that stuff is cleaned up
automatically 15 minutes after boot and every day, *if* you have the
appropriate cleanup rules (which we don't have by default).
This commit is contained in:
Eelco Dolstra
2014-04-17 16:10:48 +02:00
parent bb9304e280
commit 560a1103ad
3 changed files with 36 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import ./make-test.nix {
[ { device = "/root/swapfile"; size = 128; } ];
environment.variables.EDITOR = pkgs.lib.mkOverride 0 "emacs";
services.nixosManual.enable = pkgs.lib.mkOverride 0 true;
systemd.tmpfiles.rules = [ "d /tmp 1777 root root 10d" ];
};
testScript =
@@ -69,6 +70,16 @@ import ./make-test.nix {
$machine->waitForUnit('systemd-udev-settle.service');
$machine->succeed('lsmod | grep psmouse');
};
# Test whether systemd-tmpfiles-clean works.
subtest "tmpfiles", sub {
$machine->succeed('touch /tmp/foo');
$machine->succeed('systemctl start systemd-tmpfiles-clean');
$machine->succeed('[ -e /tmp/foo ]');
$machine->succeed('date -s "@$(($(date +%s) + 1000000))"'); # move into the future
$machine->succeed('systemctl start systemd-tmpfiles-clean');
$machine->fail('[ -e /tmp/foo ]');
};
'';
}