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