summary refs log tree commit diff
path: root/nixos/tests/os-prober.nix
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2021-05-01 20:15:42 +0200
committerMichael Weiss <dev.primeos@gmail.com>2021-05-01 20:20:29 +0200
commitc6325c8325c597560c0f67915516cd1d49928bcc (patch)
tree22a327729105968472654f6c6df2767ec3baa1fe /nixos/tests/os-prober.nix
parent7d8237894955d9a4538d1c04fb5b6318906c28c6 (diff)
downloadnixpkgs-c6325c8325c597560c0f67915516cd1d49928bcc.tar
nixpkgs-c6325c8325c597560c0f67915516cd1d49928bcc.tar.gz
nixpkgs-c6325c8325c597560c0f67915516cd1d49928bcc.tar.bz2
nixpkgs-c6325c8325c597560c0f67915516cd1d49928bcc.tar.lz
nixpkgs-c6325c8325c597560c0f67915516cd1d49928bcc.tar.xz
nixpkgs-c6325c8325c597560c0f67915516cd1d49928bcc.tar.zst
nixpkgs-c6325c8325c597560c0f67915516cd1d49928bcc.zip
nixos/tests: Replace QEMU_OPTS usages with virtualisation.qemu.options
See [0]: "QEMU_OPTS is something that should be set by people running VM
tests interactively, to do port forwardings etc.
We really should not poke with it from the test script - that's what
virtualisation.qemu.options is for."

[0]: https://github.com/NixOS/nixpkgs/pull/119615#discussion_r624145020

Co-authored-by: Florian Klink <flokli@flokli.de>
Diffstat (limited to 'nixos/tests/os-prober.nix')
-rw-r--r--nixos/tests/os-prober.nix8
1 files changed, 3 insertions, 5 deletions
diff --git a/nixos/tests/os-prober.nix b/nixos/tests/os-prober.nix
index f778d30bdc0..3cc38ebe347 100644
--- a/nixos/tests/os-prober.nix
+++ b/nixos/tests/os-prober.nix
@@ -69,6 +69,9 @@ in {
       imports = [ ../modules/profiles/installation-device.nix
                   ../modules/profiles/base.nix ];
       virtualisation.memorySize = 1300;
+      # To add the secondary disk:
+      virtualisation.qemu.options = [ "-drive index=2,file=${debianImage}/disk-image.qcow2,read-only,if=virtio" ];
+
       # The test cannot access the network, so any packages
       # nixos-rebuild needs must be included in the VM.
       system.extraDependencies = with pkgs;
@@ -95,11 +98,6 @@ in {
   });
 
   testScript = ''
-    # hack to add the secondary disk
-    os.environ[
-        "QEMU_OPTS"
-    ] = "-drive index=2,file=${debianImage}/disk-image.qcow2,read-only,if=virtio"
-
     machine.start()
     machine.succeed("udevadm settle")
     machine.wait_for_unit("multi-user.target")