summary refs log tree commit diff
path: root/nixos/tests/misc.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-17 16:10:48 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-17 16:14:56 +0200
commit560a1103adf3834698c73cc98a5b70ec6aa3bbcc (patch)
tree09d86130862afcae12603bfaf3c2fb198548c341 /nixos/tests/misc.nix
parentbb9304e2806f316ce201d05416b3c4db975b62b3 (diff)
downloadnixpkgs-560a1103adf3834698c73cc98a5b70ec6aa3bbcc.tar
nixpkgs-560a1103adf3834698c73cc98a5b70ec6aa3bbcc.tar.gz
nixpkgs-560a1103adf3834698c73cc98a5b70ec6aa3bbcc.tar.bz2
nixpkgs-560a1103adf3834698c73cc98a5b70ec6aa3bbcc.tar.lz
nixpkgs-560a1103adf3834698c73cc98a5b70ec6aa3bbcc.tar.xz
nixpkgs-560a1103adf3834698c73cc98a5b70ec6aa3bbcc.tar.zst
nixpkgs-560a1103adf3834698c73cc98a5b70ec6aa3bbcc.zip
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).
Diffstat (limited to 'nixos/tests/misc.nix')
-rw-r--r--nixos/tests/misc.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/nixos/tests/misc.nix b/nixos/tests/misc.nix
index 76298f1abd4..363be2cbb35 100644
--- a/nixos/tests/misc.nix
+++ b/nixos/tests/misc.nix
@@ -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 ]');
+      };
     '';
 
 }