summary refs log tree commit diff
path: root/nixos/tests/hardened.nix
diff options
context:
space:
mode:
authorJoachim Fasting <joachifm@fastmail.fm>2017-09-22 23:20:42 +0200
committerJoachim Fasting <joachifm@fastmail.fm>2017-09-22 23:53:27 +0200
commitbccaf630679a5251549fd11abb08eb35e6bcec8e (patch)
treeffaf43da47de9718e4fc24b8b1351314cdb48832 /nixos/tests/hardened.nix
parent15a4f9d8efd4418bc748b57aa7df377b1c024974 (diff)
downloadnixpkgs-bccaf630679a5251549fd11abb08eb35e6bcec8e.tar
nixpkgs-bccaf630679a5251549fd11abb08eb35e6bcec8e.tar.gz
nixpkgs-bccaf630679a5251549fd11abb08eb35e6bcec8e.tar.bz2
nixpkgs-bccaf630679a5251549fd11abb08eb35e6bcec8e.tar.lz
nixpkgs-bccaf630679a5251549fd11abb08eb35e6bcec8e.tar.xz
nixpkgs-bccaf630679a5251549fd11abb08eb35e6bcec8e.tar.zst
nixpkgs-bccaf630679a5251549fd11abb08eb35e6bcec8e.zip
nixos/hardened test: add failing test-case for deferred mounts
Diffstat (limited to 'nixos/tests/hardened.nix')
-rw-r--r--nixos/tests/hardened.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/nixos/tests/hardened.nix b/nixos/tests/hardened.nix
index ee7ffe83ba3..cb33b69e719 100644
--- a/nixos/tests/hardened.nix
+++ b/nixos/tests/hardened.nix
@@ -10,6 +10,17 @@ import ./make-test.nix ({ pkgs, ...} : {
     { users.users.alice = { isNormalUser = true; extraGroups = [ "proc" ]; };
       users.users.sybil = { isNormalUser = true; group = "wheel"; };
       imports = [ ../modules/profiles/hardened.nix ];
+      virtualisation.emptyDiskImages = [ 4096 ];
+      boot.initrd.postDeviceCommands = ''
+        ${pkgs.dosfstools}/bin/mkfs.vfat -n EFISYS /dev/vdb
+      '';
+      fileSystems = lib.mkVMOverride {
+        "/efi" = {
+          device = "/dev/disk/by-label/EFISYS";
+          fsType = "vfat";
+          options = [ "noauto" ];
+        };
+      };
     };
 
   testScript =
@@ -42,5 +53,13 @@ import ./make-test.nix ({ pkgs, ...} : {
       subtest "kcore", sub {
           $machine->fail("cat /proc/kcore");
       };
+
+      # Test deferred mount
+      subtest "mount", sub {
+        $machine->fail("mountpoint -q /efi"); # was deferred
+        $machine->execute("mkdir -p /efi");
+        $machine->succeed("mount /dev/disk/by-label/EFISYS /efi");
+        $machine->succeed("mountpoint -q /efi"); # now mounted
+      };
     '';
 })