virtualboxKvm: init at 20240226
This commit is contained in:
committed by
Julian Stecklina
parent
13aff9b34c
commit
7dd125e9a0
@@ -1,4 +1,4 @@
|
||||
{ config, stdenv, fetchurl, lib, acpica-tools, dev86, pam, libxslt, libxml2, wrapQtAppsHook
|
||||
{ config, stdenv, fetchurl, fetchpatch, lib, acpica-tools, dev86, pam, libxslt, libxml2, wrapQtAppsHook
|
||||
, libX11, xorgproto, libXext, libXcursor, libXmu, libIDL, SDL2, libcap, libGL, libGLU
|
||||
, libpng, glib, lvm2, libXrandr, libXinerama, libopus, libtpms, qtbase, qtx11extras
|
||||
, qttools, qtsvg, qtwayland, pkg-config, which, docbook_xsl, docbook_xml_dtd_43
|
||||
@@ -17,6 +17,7 @@
|
||||
, headless ? false
|
||||
, enable32bitGuests ? true
|
||||
, enableWebService ? false
|
||||
, enableKvm ? false
|
||||
, extraConfigureFlags ? ""
|
||||
}:
|
||||
|
||||
@@ -27,6 +28,10 @@ let
|
||||
# Use maintainers/scripts/update.nix to update the version and all related hashes or
|
||||
# change the hashes in extpack.nix and guest-additions/default.nix as well manually.
|
||||
version = "7.0.14";
|
||||
|
||||
# The KVM build is not compatible to VirtualBox's kernel modules. So don't export
|
||||
# modsrc at all.
|
||||
withModsrc = !enableKvm;
|
||||
in stdenv.mkDerivation {
|
||||
pname = "virtualbox";
|
||||
inherit version;
|
||||
@@ -36,7 +41,7 @@ in stdenv.mkDerivation {
|
||||
sha256 = "45860d834804a24a163c1bb264a6b1cb802a5bc7ce7e01128072f8d6a4617ca9";
|
||||
};
|
||||
|
||||
outputs = [ "out" "modsrc" ];
|
||||
outputs = [ "out" ] ++ optional withModsrc "modsrc";
|
||||
|
||||
nativeBuildInputs = [ pkg-config which docbook_xsl docbook_xml_dtd_43 yasm glslang ]
|
||||
++ optional (!headless) wrapQtAppsHook;
|
||||
@@ -97,7 +102,17 @@ in stdenv.mkDerivation {
|
||||
++ optional (!headless && enableHardening) (substituteAll {
|
||||
src = ./qt-env-vars.patch;
|
||||
qtPluginPath = "${qtbase.bin}/${qtbase.qtPluginPrefix}:${qtsvg.bin}/${qtbase.qtPluginPrefix}:${qtwayland.bin}/${qtbase.qtPluginPrefix}";
|
||||
})
|
||||
})
|
||||
# While the KVM patch should not break any other behavior if --with-kvm is not specified,
|
||||
# we don't take any chances and only apply it if people actually want to use KVM support.
|
||||
++ optional enableKvm (fetchpatch
|
||||
(let
|
||||
patchVersion = "20240226";
|
||||
in {
|
||||
name = "virtualbox-${version}-kvm-dev-${patchVersion}.patch";
|
||||
url = "https://github.com/cyberus-technology/virtualbox-kvm/releases/download/dev-${patchVersion}/virtualbox-${version}-kvm-dev-${patchVersion}.patch";
|
||||
hash = "sha256-3YT1ZN/TwoNWNb2eqOcPF8GTrVGfOPaPb8vpGoPNISY=";
|
||||
}))
|
||||
++ [
|
||||
./qt-dependency-paths.patch
|
||||
# https://github.com/NixOS/nixpkgs/issues/123851
|
||||
@@ -159,6 +174,7 @@ in stdenv.mkDerivation {
|
||||
${optionalString (!enable32bitGuests) "--disable-vmmraw"} \
|
||||
${optionalString enableWebService "--enable-webservice"} \
|
||||
${optionalString (open-watcom-bin != null) "--with-ow-dir=${open-watcom-bin}"} \
|
||||
${optionalString (enableKvm) "--with-kvm"} \
|
||||
${extraConfigureFlags} \
|
||||
--disable-kmods
|
||||
sed -e 's@PKG_CONFIG_PATH=.*@PKG_CONFIG_PATH=${libIDL}/lib/pkgconfig:${glib.dev}/lib/pkgconfig ${libIDL}/bin/libIDL-config-2@' \
|
||||
@@ -218,7 +234,9 @@ in stdenv.mkDerivation {
|
||||
ln -sv $libexec/nls "$out/share/virtualbox"
|
||||
''}
|
||||
|
||||
cp -rv out/linux.*/${buildType}/bin/src "$modsrc"
|
||||
${optionalString withModsrc ''
|
||||
cp -rv out/linux.*/${buildType}/bin/src "$modsrc"
|
||||
''}
|
||||
|
||||
mkdir -p "$out/share/virtualbox"
|
||||
cp -rv src/VBox/Main/UnattendedTemplates "$out/share/virtualbox"
|
||||
|
||||
@@ -35924,6 +35924,10 @@ with pkgs;
|
||||
inherit (gnome2) libIDL;
|
||||
});
|
||||
|
||||
virtualboxKvm = lowPrio (virtualbox.override {
|
||||
enableKvm = true;
|
||||
});
|
||||
|
||||
virtualboxHardened = lowPrio (virtualbox.override {
|
||||
enableHardening = true;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user