diff --git a/nixos/tests/virtualbox.nix b/nixos/tests/virtualbox.nix index 4eb402a7d36e..1c1b0dac7f37 100644 --- a/nixos/tests/virtualbox.nix +++ b/nixos/tests/virtualbox.nix @@ -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; @@ -26,7 +17,8 @@ let #!${pkgs.runtimeShell} -xe export PATH="${lib.makeBinPath [ pkgs.coreutils pkgs.util-linux ]}" - mkdir -p /run/dbus + mkdir -p /run/dbus /var + ln -s /run /var cat > /etc/passwd <&2 & disown %1")) wait_for_startup_headless() wait_for_vm_boot_headless() shutdown_vm_headless() @@ -476,6 +465,8 @@ in mapAttrs (mkVBoxTest false vboxVMs) { ''; host-usb-permissions = '' + import sys + user_usb = remove_uuids(vbm("list usbhost")) print(user_usb, file=sys.stderr) root_usb = remove_uuids(machine.succeed("VBoxManage list usbhost")) diff --git a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix index da9f32b9c685..538ebfa78cf8 100644 --- a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix +++ b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix @@ -45,26 +45,15 @@ in stdenv.mkDerivation rec { patchFlags = [ "-p1" "-d" "src/vboxguest-${version}" ]; unpackPhase = '' - ${if stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux" then '' - isoinfo -J -i $src -x /VBoxLinuxAdditions.run > ./VBoxLinuxAdditions.run - chmod 755 ./VBoxLinuxAdditions.run - # An overflow leads the is-there-enough-space check to fail when there's too much space available, so fake how much space there is - sed -i 's/\$leftspace/16383/' VBoxLinuxAdditions.run - ./VBoxLinuxAdditions.run --noexec --keep - '' - else throw ("Architecture: "+stdenv.hostPlatform.system+" not supported for VirtualBox guest additions") - } + isoinfo -J -i $src -x /VBoxLinuxAdditions.run > ./VBoxLinuxAdditions.run + chmod 755 ./VBoxLinuxAdditions.run + # An overflow leads the is-there-enough-space check to fail when there's too much space available, so fake how much space there is + sed -i 's/\$leftspace/16383/' VBoxLinuxAdditions.run + ./VBoxLinuxAdditions.run --noexec --keep # Unpack files cd install - ${if stdenv.hostPlatform.system == "i686-linux" then '' - tar xfvj VBoxGuestAdditions-x86.tar.bz2 - '' - else if stdenv.hostPlatform.system == "x86_64-linux" then '' - tar xfvj VBoxGuestAdditions-amd64.tar.bz2 - '' - else throw ("Architecture: "+stdenv.hostPlatform.system+" not supported for VirtualBox guest additions") - } + tar xfvj VBoxGuestAdditions-${if stdenv.hostPlatform.is32bit then "x86" else "amd64"}.tar.bz2 ''; buildPhase = '' @@ -158,7 +147,7 @@ in stdenv.mkDerivation rec { sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; license = "GPL"; maintainers = [ lib.maintainers.sander ]; - platforms = lib.platforms.linux; - broken = kernel.kernelAtLeast "5.17"; + platforms = [ "i686-linux" "x86_64-linux" ]; + broken = kernel.kernelAtLeast (if stdenv.hostPlatform.is32bit then "5.10" else "5.17"); }; }