summary refs log tree commit diff
path: root/nixos/tests/misc.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/tests/misc.nix')
-rw-r--r--nixos/tests/misc.nix26
1 files changed, 22 insertions, 4 deletions
diff --git a/nixos/tests/misc.nix b/nixos/tests/misc.nix
index 705ea0d0b86..e33581b4d2d 100644
--- a/nixos/tests/misc.nix
+++ b/nixos/tests/misc.nix
@@ -3,12 +3,23 @@
 import ./make-test.nix {
 
   machine =
-    { config, pkgs, ... }:
-    { swapDevices = pkgs.lib.mkOverride 0
+    { config, lib, pkgs, ... }:
+    with lib;
+    { swapDevices = mkOverride 0
         [ { device = "/root/swapfile"; size = 128; } ];
-      environment.variables.EDITOR = pkgs.lib.mkOverride 0 "emacs";
-      services.nixosManual.enable = pkgs.lib.mkOverride 0 true;
+      environment.variables.EDITOR = mkOverride 0 "emacs";
+      services.nixosManual.enable = mkOverride 0 true;
       systemd.tmpfiles.rules = [ "d /tmp 1777 root root 10d" ];
+      fileSystems = mkVMOverride { "/tmp2" =
+        { device = "none";
+          fsType = "tmpfs";
+          options = "mode=1777,noauto";
+        };
+      };
+      systemd.automounts = singleton
+        { wantedBy = [ "multi-user.target" ];
+          where = "/tmp2";
+        };
     };
 
   testScript =
@@ -80,6 +91,13 @@ import ./make-test.nix {
           $machine->succeed('systemctl start systemd-tmpfiles-clean');
           $machine->fail('[ -e /tmp/foo ]');
       };
+
+      # Test whether automounting works.
+      subtest "automount", sub {
+          $machine->fail("grep '/tmp2 tmpfs' /proc/mounts");
+          $machine->succeed("touch /tmp2/x");
+          $machine->succeed("grep '/tmp2 tmpfs' /proc/mounts");
+      };
     '';
 
 }