Merge pull request #101246 from rnhmjoj/vm-fix

nixos: fix qemu_test being used in normal VMs

authored by

Andreas Rammhold and committed by
GitHub
89351525 404182e0

+14 -6
-4
nixos/lib/build-vms.nix
··· 18 19 inherit pkgs; 20 21 - qemu = pkgs.qemu_test; 22 - 23 - 24 # Build a virtual network from an attribute set `{ machine1 = 25 # config1; ... machineN = configN; }', where `machineX' is the 26 # hostname and `configX' is a NixOS system configuration. Each ··· 39 [ ../modules/virtualisation/qemu-vm.nix 40 ../modules/testing/test-instrumentation.nix # !!! should only get added for automated test runs 41 { key = "no-manual"; documentation.nixos.enable = false; } 42 - { key = "qemu"; system.build.qemu = qemu; } 43 { key = "nodes"; _module.args.nodes = nodes; } 44 ] ++ optional minimal ../modules/testing/minimal-kernel.nix; 45 };
··· 18 19 inherit pkgs; 20 21 # Build a virtual network from an attribute set `{ machine1 = 22 # config1; ... machineN = configN; }', where `machineX' is the 23 # hostname and `configX' is a NixOS system configuration. Each ··· 36 [ ../modules/virtualisation/qemu-vm.nix 37 ../modules/testing/test-instrumentation.nix # !!! should only get added for automated test runs 38 { key = "no-manual"; documentation.nixos.enable = false; } 39 { key = "nodes"; _module.args.nodes = nodes; } 40 ] ++ optional minimal ../modules/testing/minimal-kernel.nix; 41 };
+4 -1
nixos/modules/testing/test-instrumentation.nix
··· 51 # we avoid defining consoles if not possible. 52 # TODO: refactor such that test-instrumentation can import qemu-vm 53 # or declare virtualisation.qemu.console option in a module that's always imported 54 - virtualisation = lib.optionalAttrs (options ? virtualisation.qemu.consoles) { qemu.consoles = [ qemuSerialDevice ]; }; 55 56 boot.initrd.preDeviceCommands = 57 ''
··· 51 # we avoid defining consoles if not possible. 52 # TODO: refactor such that test-instrumentation can import qemu-vm 53 # or declare virtualisation.qemu.console option in a module that's always imported 54 + virtualisation.qemu = { 55 + consoles = lib.optional (options ? virtualisation.qemu.consoles) qemuSerialDevice; 56 + package = pkgs.qemu_test; 57 + }; 58 59 boot.initrd.preDeviceCommands = 60 ''
+10 -1
nixos/modules/virtualisation/qemu-vm.nix
··· 14 15 let 16 17 - qemu = config.system.build.qemu or pkgs.qemu_test; 18 19 cfg = config.virtualisation; 20 21 consoles = lib.concatMapStringsSep " " (c: "console=${c}") cfg.qemu.consoles; 22 ··· 401 }; 402 403 virtualisation.qemu = { 404 options = 405 mkOption { 406 type = types.listOf types.unspecified;
··· 14 15 let 16 17 18 cfg = config.virtualisation; 19 + 20 + qemu = cfg.qemu.package; 21 22 consoles = lib.concatMapStringsSep " " (c: "console=${c}") cfg.qemu.consoles; 23 ··· 402 }; 403 404 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 + 413 options = 414 mkOption { 415 type = types.listOf types.unspecified;