git.iko.soy/typeable/nixpkgs
on master help sign in
nixos: fix qemu_test being used in normal VMs

This is an attempt to fixup PR #49403.

commitbc2188b083dfbbe749a221023e2960b60d4c8951 authorrnhmjoj <rnhmjoj@inventati.org> dateWed 21 Oct 2020, 13:02 (6 years ago) parentd95b8c3
3 files changed+14−6
nixos/lib/build-vms.nix−4 nixos/modules/testing/test-instrumentation.nix+4−1 nixos/modules/virtualisation/qemu-vm.nix+10−1
nixos/lib/build-vms.nix−4
@@ -18,9 +18,6 @@ rec {
1818
1919 inherit pkgs;
2020
21− qemu = pkgs.qemu_test;
22−
23−
2421 # Build a virtual network from an attribute set `{ machine1 =
2522 # config1; ... machineN = configN; }', where `machineX' is the
2623 # hostname and `configX' is a NixOS system configuration. Each
@@ -39,7 +36,6 @@ rec {
3936 [ ../modules/virtualisation/qemu-vm.nix
4037 ../modules/testing/test-instrumentation.nix # !!! should only get added for automated test runs
4138 { key = "no-manual"; documentation.nixos.enable = false; }
42− { key = "qemu"; system.build.qemu = qemu; }
4339 { key = "nodes"; _module.args.nodes = nodes; }
4440 ] ++ optional minimal ../modules/testing/minimal-kernel.nix;
4541 };
nixos/modules/testing/test-instrumentation.nix+4−1
@@ -51,7 +51,10 @@ with import ../../lib/qemu-flags.nix { inherit pkgs; };
5151 # we avoid defining consoles if not possible.
5252 # TODO: refactor such that test-instrumentation can import qemu-vm
5353 # or declare virtualisation.qemu.console option in a module that's always imported
54− virtualisation = lib.optionalAttrs (options ? virtualisation.qemu.consoles) { qemu.consoles = [ qemuSerialDevice ]; };
54+ virtualisation.qemu = {
55+ consoles = lib.optional (options ? virtualisation.qemu.consoles) qemuSerialDevice;
56+ package = pkgs.qemu_test;
57+ };
5558
5659 boot.initrd.preDeviceCommands =
5760 ''
nixos/modules/virtualisation/qemu-vm.nix+10−1
@@ -14,10 +14,11 @@ with import ../../lib/qemu-flags.nix { inherit pkgs; };
1414
1515let
1616
17− qemu = config.system.build.qemu or pkgs.qemu_test;
1817
1918 cfg = config.virtualisation;
2019
20+ qemu = cfg.qemu.package;
21+
2122 consoles = lib.concatMapStringsSep " " (c: "console=${c}") cfg.qemu.consoles;
2223
2324 driveOpts = { ... }: {
@@ -401,6 +402,14 @@ in
401402 };
402403
403404 virtualisation.qemu = {
405+ package =
406+ mkOption {
407+ type = types.package;
408+ default = pkgs.qemu;
409+ example = "pkgs.qemu_test";
410+ description = "QEMU package to use.";
411+ };
412+
404413 options =
405414 mkOption {
406415 type = types.listOf types.unspecified;