diff options
author | Ryan Lahfa <masterancpp@gmail.com> | 2023-06-08 18:20:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-08 18:20:23 +0200 |
commit | a384c9b01daffc4cab9ed1fce4f8c603739c77a6 (patch) | |
tree | b7d5f24363b1cd3695bf86180310a07ac2be6a46 /nixos | |
parent | d604f5fd923d66671baf4c0b6b6ebc27267dbd22 (diff) | |
parent | 89952f7bb678de4c51dcc8f42110fe9ad1f52260 (diff) |
Merge pull request #234030 from NixOS/cleanup-overlay-mounts
nixosTests: fix tests that relies on an empty rootfs using a bootloader
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/tests/initrd-luks-empty-passphrase.nix | 5 | ||||
-rw-r--r-- | nixos/tests/luks.nix | 2 | ||||
-rw-r--r-- | nixos/tests/lvm2/systemd-stage-1.nix | 2 | ||||
-rw-r--r-- | nixos/tests/systemd-initrd-btrfs-raid.nix | 2 | ||||
-rw-r--r-- | nixos/tests/systemd-initrd-luks-fido2.nix | 2 | ||||
-rw-r--r-- | nixos/tests/systemd-initrd-luks-keyfile.nix | 2 | ||||
-rw-r--r-- | nixos/tests/systemd-initrd-luks-password.nix | 2 | ||||
-rw-r--r-- | nixos/tests/systemd-initrd-luks-tpm2.nix | 2 | ||||
-rw-r--r-- | nixos/tests/systemd-initrd-networkd-ssh.nix | 8 | ||||
-rw-r--r-- | nixos/tests/systemd-initrd-swraid.nix | 2 |
10 files changed, 26 insertions, 3 deletions
diff --git a/nixos/tests/initrd-luks-empty-passphrase.nix b/nixos/tests/initrd-luks-empty-passphrase.nix index d2805f2f1734..521456e7e0b2 100644 --- a/nixos/tests/initrd-luks-empty-passphrase.nix +++ b/nixos/tests/initrd-luks-empty-passphrase.nix @@ -18,6 +18,11 @@ in { emptyDiskImages = [ 512 ]; useBootLoader = true; useEFIBoot = true; + # This requires to have access + # to a host Nix store as + # the new root device is /dev/vdb + # an empty 512MiB drive, containing no Nix store. + mountHostNixStore = true; }; boot.loader.systemd-boot.enable = true; diff --git a/nixos/tests/luks.nix b/nixos/tests/luks.nix index c2b95c6a95fb..d5ac550a3c57 100644 --- a/nixos/tests/luks.nix +++ b/nixos/tests/luks.nix @@ -7,6 +7,8 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: { emptyDiskImages = [ 512 512 ]; useBootLoader = true; useEFIBoot = true; + # To boot off the encrypted disk, we need to have a init script which comes from the Nix store + mountHostNixStore = true; }; boot.loader.systemd-boot.enable = true; diff --git a/nixos/tests/lvm2/systemd-stage-1.nix b/nixos/tests/lvm2/systemd-stage-1.nix index b711cd22d7f4..b581f2b23507 100644 --- a/nixos/tests/lvm2/systemd-stage-1.nix +++ b/nixos/tests/lvm2/systemd-stage-1.nix @@ -65,6 +65,8 @@ in import ../make-test-python.nix ({ pkgs, ... }: { emptyDiskImages = [ 8192 8192 ]; useBootLoader = true; useEFIBoot = true; + # To boot off the LVM disk, we need to have a init script which comes from the Nix store. + mountHostNixStore = true; }; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; diff --git a/nixos/tests/systemd-initrd-btrfs-raid.nix b/nixos/tests/systemd-initrd-btrfs-raid.nix index c9cdf0060b1b..9196033789cb 100644 --- a/nixos/tests/systemd-initrd-btrfs-raid.nix +++ b/nixos/tests/systemd-initrd-btrfs-raid.nix @@ -6,6 +6,8 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: { virtualisation = { emptyDiskImages = [ 512 512 ]; useBootLoader = true; + # Booting off the BTRFS RAID requires an available init script from the Nix store + mountHostNixStore = true; useEFIBoot = true; }; boot.loader.systemd-boot.enable = true; diff --git a/nixos/tests/systemd-initrd-luks-fido2.nix b/nixos/tests/systemd-initrd-luks-fido2.nix index e80d95f79c7e..32c79b731d80 100644 --- a/nixos/tests/systemd-initrd-luks-fido2.nix +++ b/nixos/tests/systemd-initrd-luks-fido2.nix @@ -6,6 +6,8 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: { virtualisation = { emptyDiskImages = [ 512 ]; useBootLoader = true; + # Booting off the encrypted disk requires having a Nix store available for the init script + mountHostNixStore = true; useEFIBoot = true; qemu.package = lib.mkForce (pkgs.qemu_test.override { canokeySupport = true; }); qemu.options = [ "-device canokey,file=/tmp/canokey-file" ]; diff --git a/nixos/tests/systemd-initrd-luks-keyfile.nix b/nixos/tests/systemd-initrd-luks-keyfile.nix index 257243d92a1d..5ca0f48c333a 100644 --- a/nixos/tests/systemd-initrd-luks-keyfile.nix +++ b/nixos/tests/systemd-initrd-luks-keyfile.nix @@ -14,6 +14,8 @@ in { virtualisation = { emptyDiskImages = [ 512 ]; useBootLoader = true; + # Necessary to boot off the encrypted disk because it requires a init script coming from the Nix store + mountHostNixStore = true; useEFIBoot = true; }; boot.loader.systemd-boot.enable = true; diff --git a/nixos/tests/systemd-initrd-luks-password.nix b/nixos/tests/systemd-initrd-luks-password.nix index 2dd3f304e82a..a90a59feed6f 100644 --- a/nixos/tests/systemd-initrd-luks-password.nix +++ b/nixos/tests/systemd-initrd-luks-password.nix @@ -6,6 +6,8 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: { virtualisation = { emptyDiskImages = [ 512 512 ]; useBootLoader = true; + # Booting off the encrypted disk requires an available init script + mountHostNixStore = true; useEFIBoot = true; }; boot.loader.systemd-boot.enable = true; diff --git a/nixos/tests/systemd-initrd-luks-tpm2.nix b/nixos/tests/systemd-initrd-luks-tpm2.nix index 734ef38579f0..73aa190ad620 100644 --- a/nixos/tests/systemd-initrd-luks-tpm2.nix +++ b/nixos/tests/systemd-initrd-luks-tpm2.nix @@ -6,6 +6,8 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: { virtualisation = { emptyDiskImages = [ 512 ]; useBootLoader = true; + # Booting off the TPM2-encrypted device requires an available init script + mountHostNixStore = true; useEFIBoot = true; qemu.options = ["-chardev socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0"]; }; diff --git a/nixos/tests/systemd-initrd-networkd-ssh.nix b/nixos/tests/systemd-initrd-networkd-ssh.nix index 943552613be9..46dbdf537393 100644 --- a/nixos/tests/systemd-initrd-networkd-ssh.nix +++ b/nixos/tests/systemd-initrd-networkd-ssh.nix @@ -10,13 +10,15 @@ import ./make-test-python.nix ({ lib, ... }: { virtualisation = { emptyDiskImages = [ 4096 ]; useBootLoader = true; + # Booting off the encrypted disk requires an available init script from the Nix store + mountHostNixStore = true; useEFIBoot = true; }; specialisation.encrypted-root.configuration = { - virtualisation.bootDevice = "/dev/mapper/root"; + virtualisation.rootDevice = "/dev/mapper/root"; boot.initrd.luks.devices = lib.mkVMOverride { - root.device = "/dev/vdc"; + root.device = "/dev/vdb"; }; boot.initrd.systemd.enable = true; boot.initrd.network = { @@ -61,7 +63,7 @@ import ./make-test-python.nix ({ lib, ... }: { server.wait_for_unit("multi-user.target") server.succeed( - "echo somepass | cryptsetup luksFormat --type=luks2 /dev/vdc", + "echo somepass | cryptsetup luksFormat --type=luks2 /dev/vdb", "bootctl set-default nixos-generation-1-specialisation-encrypted-root.conf", "sync", ) diff --git a/nixos/tests/systemd-initrd-swraid.nix b/nixos/tests/systemd-initrd-swraid.nix index d201ba99a204..0d5a1c6354d0 100644 --- a/nixos/tests/systemd-initrd-swraid.nix +++ b/nixos/tests/systemd-initrd-swraid.nix @@ -6,6 +6,8 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: { virtualisation = { emptyDiskImages = [ 512 512 ]; useBootLoader = true; + # Booting off the RAID requires an available init script + mountHostNixStore = true; useEFIBoot = true; }; boot.loader.systemd-boot.enable = true; |