nixosTests.virtualbox: always use nested KVM

Nested KVM has been enabled by default on Linux on Intel for a long
time now, and since Virtualbox 6.1.0, the test won't run without it
because Virtualbox now only supports running hardware-accelerated VMs.

Additionally, this means we can 64-bit guests by default.  The 32-bit
guest additions don't currently build, so this is important to have
the tests work with the default options.
This commit is contained in:
Alyssa Ross 2022-06-26 11:41:05 +00:00
parent 97a16f52d7
commit 6ce4afce63
No known key found for this signature in database
GPG Key ID: F9DBED4859B271C0

View File

@ -3,18 +3,9 @@
pkgs ? import ../.. { inherit system config; },
debug ? false,
enableUnfree ? false,
# Nested KVM virtualization (https://www.linux-kvm.org/page/Nested_Guests)
# requires a modprobe flag on the build machine: (kvm-amd for AMD CPUs)
# boot.extraModprobeConfig = "options kvm-intel nested=Y";
# Without this VirtualBox will use SW virtualization and will only be able
# to run 32-bit guests.
useKvmNestedVirt ? false,
# Whether to run 64-bit guests instead of 32-bit. Requires nested KVM.
use64bitGuest ? false
use64bitGuest ? true
}:
assert use64bitGuest -> useKvmNestedVirt;
with import ../lib/testing-python.nix { inherit system pkgs; };
with pkgs.lib;
@ -359,8 +350,7 @@ let
vmConfigs = mapAttrsToList mkVMConf vms;
in [ ./common/user-account.nix ./common/x11.nix ] ++ vmConfigs;
virtualisation.memorySize = 2048;
virtualisation.qemu.options =
if useKvmNestedVirt then ["-cpu" "kvm64,vmx=on"] else [];
virtualisation.qemu.options = ["-cpu" "kvm64,vmx=on"];
virtualisation.virtualbox.host.enable = true;
test-support.displayManager.auto.user = "alice";
users.users.alice.extraGroups = let