2014-01-05 01:57:21 +00:00
|
|
|
{ stdenv, fetchurl, lib, patchelf, cdrkit, kernel, which, makeWrapper
|
2019-12-11 23:59:03 +00:00
|
|
|
, zlib, xorg, dbus, virtualbox, dos2unix, fetchpatch, findutils, patchutils }:
|
2009-10-13 14:32:00 +01:00
|
|
|
|
2013-06-23 12:57:13 +01:00
|
|
|
let
|
2013-06-23 13:35:33 +01:00
|
|
|
version = virtualbox.version;
|
2019-09-24 10:24:13 +01:00
|
|
|
xserverVListFunc = builtins.elemAt (stdenv.lib.splitVersion xorg.xorgserver.version);
|
2017-02-12 20:06:59 +00:00
|
|
|
|
|
|
|
# Forced to 1.18 in <nixpkgs/nixos/modules/services/x11/xserver.nix>
|
|
|
|
# as it even fails to build otherwise. Still, override this even here,
|
|
|
|
# in case someone does just a standalone build
|
|
|
|
# (not via videoDrivers = ["vboxvideo"]).
|
|
|
|
# It's likely to work again in some future update.
|
|
|
|
xserverABI = let abi = xserverVListFunc 0 + xserverVListFunc 1;
|
2019-01-13 09:38:32 +00:00
|
|
|
in if abi == "119" || abi == "120" then "118" else abi;
|
2011-04-18 20:41:34 +01:00
|
|
|
|
2019-09-23 17:06:15 +01:00
|
|
|
# Specifies how to patch binaries to make sure that libraries loaded using
|
|
|
|
# dlopen are found. We grep binaries for specific library names and patch
|
|
|
|
# RUNPATH in matching binaries to contain the needed library paths.
|
|
|
|
dlopenLibs = [
|
|
|
|
{ name = "libdbus-1.so"; pkg = dbus; }
|
|
|
|
{ name = "libXfixes.so"; pkg = xorg.libXfixes; }
|
|
|
|
];
|
|
|
|
|
2019-12-11 23:59:03 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
2014-01-05 01:57:21 +00:00
|
|
|
name = "VirtualBox-GuestAdditions-${version}-${kernel.version}";
|
2012-10-09 17:41:24 +01:00
|
|
|
|
2009-10-13 14:32:00 +01:00
|
|
|
src = fetchurl {
|
2011-04-18 20:41:34 +01:00
|
|
|
url = "http://download.virtualbox.org/virtualbox/${version}/VBoxGuestAdditions_${version}.iso";
|
2019-11-26 10:58:52 +00:00
|
|
|
sha256 = "1c9ysx0fhxxginmp607b4fk74dvlr32n6w52gawm06prf4xg90nb";
|
2009-10-13 14:32:00 +01:00
|
|
|
};
|
2012-10-09 17:41:24 +01:00
|
|
|
|
2017-11-15 15:03:44 +00:00
|
|
|
KERN_DIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
|
|
|
|
KERN_INCL = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/source/include";
|
|
|
|
|
2016-02-26 17:38:15 +00:00
|
|
|
hardeningDisable = [ "pic" ];
|
2016-02-07 22:43:59 +00:00
|
|
|
|
2017-11-15 15:03:44 +00:00
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration";
|
2016-09-26 13:49:11 +01:00
|
|
|
|
2018-09-27 22:38:10 +01:00
|
|
|
nativeBuildInputs = [ patchelf makeWrapper ];
|
virtualbox: 5.2.28 -> 6.0.6
Quite some fixing was needed to get this to work.
Changes in VirtualBox and additions:
- VirtualBox is no longer officially supported on 32-bit hosts so i686-linux is removed from platforms
for VirtualBox and the extension pack. 32-bit additions still work.
- There was a refactoring of kernel module makefiles and two resulting bugs affected us which had to be patched.
These bugs were reported to the bug tracker (see comments near patches).
- The Qt5X11Extras makefile patch broke. Fixed it to apply again, making the libraries logic simpler
and more correct (it just uses a different base path instead of always linking to Qt5X11Extras).
- Added a patch to remove "test1" and "test2" kernel messages due to forgotten debugging code.
- virtualbox-host NixOS module: the VirtualBoxVM executable should be setuid not VirtualBox.
This matches how the official installer sets it up.
- Additions: replaced a for loop for installing kernel modules with just a "make install",
which seems to work without any of the things done in the previous code.
- Additions: The package defined buildCommand which resulted in phases not running, including RUNPATH
stripping in fixupPhase, and installPhase was defined which was not even run. Fixed this by
refactoring using phases. Had to set dontStrip otherwise binaries were broken by stripping.
The libdbus path had to be added later in fixupPhase because it is used via dlopen not directly linked.
- Additions: Added zlib and libc to patchelf, otherwise runtime library errors result from some binaries.
For some reason the missing libc only manifested itself for mount.vboxsf when included in the initrd.
Changes in nixos/tests/virtualbox:
- Update the simple-gui test to send the right keys to start the VM. With VirtualBox 5
it was enough to just send "return", but with 6 the Tools thing may be selected by
default. Send "home" to reliably select Tools, "down" to move to the VM and "return"
to start it.
- Disable the VirtualBox UART by default because it causes a crash due to a regression
in VirtualBox (specific to software virtualization and serial port usage). It can
still be enabled using an option but there is an assert that KVM nested virtualization
is enabled, which works around the problem (see below).
- Add an option to enable nested KVM virtualization, allowing VirtualBox to use hardware
virtualization. This works around the UART problem and also allows using 64-bit
guests, but requires a kernel module parameter.
- Add an option to run 64-bit guests. Tested that the tests pass with that. As mentioned
this requires KVM nested virtualization.
2019-05-04 15:18:39 +01:00
|
|
|
buildInputs = [ cdrkit ] ++ kernel.moduleBuildDependencies;
|
2010-11-28 10:14:07 +00:00
|
|
|
|
2019-09-26 10:58:55 +01:00
|
|
|
|
|
|
|
prePatch = ''
|
2019-09-13 16:39:27 +01:00
|
|
|
substituteInPlace src/vboxguest-${version}/vboxvideo/vbox_ttm.c \
|
|
|
|
--replace "<ttm/" "<drm/ttm/"
|
2019-12-11 23:59:03 +00:00
|
|
|
|
|
|
|
echo ${lib.escapeShellArgs patches} | \
|
|
|
|
${findutils}/bin/xargs -n1 ${patchutils}/bin/lsdiff --strip=1 --addprefix=src/vboxguest-${version}/ | \
|
|
|
|
${findutils}/bin/xargs ${dos2unix}/bin/dos2unix
|
2019-09-13 16:39:27 +01:00
|
|
|
'';
|
|
|
|
|
2019-09-26 10:58:55 +01:00
|
|
|
patchFlags = [ "-p1" "-d" "src/vboxguest-${version}" ];
|
2019-11-26 10:58:52 +00:00
|
|
|
# Kernel 5.4 fix, should be fixed with next upstream release
|
|
|
|
# https://www.virtualbox.org/ticket/18945
|
2019-12-11 23:59:03 +00:00
|
|
|
patches = lib.concatLists (lib.mapAttrsToList (changeset: args:
|
|
|
|
map (arg:
|
|
|
|
fetchpatch ({
|
|
|
|
name = "kernel-5.4-fix-${changeset}.patch";
|
|
|
|
url = "https://www.virtualbox.org/changeset/${changeset}/vbox?format=diff";
|
|
|
|
} // arg)) args) {
|
|
|
|
"81586" = [{
|
|
|
|
sha256 = "126z67x6vy65w6jlqbh4z4f1cffxnycwb69vns0154bawbsbxsiw";
|
|
|
|
stripLen = 5;
|
|
|
|
extraPrefix = "vboxguest/";
|
|
|
|
}];
|
|
|
|
"81587" = [
|
|
|
|
{
|
|
|
|
sha256 = "0simzswnl0wvnc2i9gixz99rfc7lxk1nrnskksrlrrl9hqnh0lva";
|
|
|
|
stripLen = 5;
|
|
|
|
extraPrefix = "vboxsf/";
|
|
|
|
includes = [ "*/the-linux-kernel.h" ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
sha256 = "0a8r9h3x3lcjq2fykgqhdaykp00rnnkbxz8xnxg847zgvca15y02";
|
|
|
|
stripLen = 5;
|
|
|
|
extraPrefix = "vboxguest/";
|
|
|
|
includes = [ "*/the-linux-kernel.h" ];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
"81649" = [
|
|
|
|
{
|
|
|
|
sha256 = "1p1skxlvqigydxr4sk7w51lpk7nxg0d9lppq39sdnfmgi1z0h0sc";
|
|
|
|
stripLen = 2;
|
|
|
|
extraPrefix = "vboxguest/";
|
|
|
|
includes = [ "*/cdefs.h" ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
sha256 = "1j060ggdnndyjdhkfvs15306gl7g932sim9xjmx2mnx8gjdmg37f";
|
|
|
|
stripLen = 2;
|
|
|
|
extraPrefix = "vboxsf/";
|
|
|
|
includes = [ "*/cdefs.h" ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
sha256 = "060h3a5k2yklbvlg0hyg4x87xrg37cvv3rjb67xizlwvlyy6ykkg";
|
|
|
|
stripLen = 5;
|
|
|
|
extraPrefix = "vboxguest/";
|
|
|
|
includes = [ "*/thread2-r0drv-linux.c" ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
sha256 = "0cxlkf7cy751gl8dgzr7vkims1kmx5pgzsrxyk8w18zyp5nk9glw";
|
|
|
|
stripLen = 7;
|
|
|
|
extraPrefix = "vboxvideo/";
|
|
|
|
includes = [ "*/vbox_*.c" ];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
});
|
2019-09-26 10:58:55 +01:00
|
|
|
|
virtualbox: 5.2.28 -> 6.0.6
Quite some fixing was needed to get this to work.
Changes in VirtualBox and additions:
- VirtualBox is no longer officially supported on 32-bit hosts so i686-linux is removed from platforms
for VirtualBox and the extension pack. 32-bit additions still work.
- There was a refactoring of kernel module makefiles and two resulting bugs affected us which had to be patched.
These bugs were reported to the bug tracker (see comments near patches).
- The Qt5X11Extras makefile patch broke. Fixed it to apply again, making the libraries logic simpler
and more correct (it just uses a different base path instead of always linking to Qt5X11Extras).
- Added a patch to remove "test1" and "test2" kernel messages due to forgotten debugging code.
- virtualbox-host NixOS module: the VirtualBoxVM executable should be setuid not VirtualBox.
This matches how the official installer sets it up.
- Additions: replaced a for loop for installing kernel modules with just a "make install",
which seems to work without any of the things done in the previous code.
- Additions: The package defined buildCommand which resulted in phases not running, including RUNPATH
stripping in fixupPhase, and installPhase was defined which was not even run. Fixed this by
refactoring using phases. Had to set dontStrip otherwise binaries were broken by stripping.
The libdbus path had to be added later in fixupPhase because it is used via dlopen not directly linked.
- Additions: Added zlib and libc to patchelf, otherwise runtime library errors result from some binaries.
For some reason the missing libc only manifested itself for mount.vboxsf when included in the initrd.
Changes in nixos/tests/virtualbox:
- Update the simple-gui test to send the right keys to start the VM. With VirtualBox 5
it was enough to just send "return", but with 6 the Tools thing may be selected by
default. Send "home" to reliably select Tools, "down" to move to the VM and "return"
to start it.
- Disable the VirtualBox UART by default because it causes a crash due to a regression
in VirtualBox (specific to software virtualization and serial port usage). It can
still be enabled using an option but there is an assert that KVM nested virtualization
is enabled, which works around the problem (see below).
- Add an option to enable nested KVM virtualization, allowing VirtualBox to use hardware
virtualization. This works around the UART problem and also allows using 64-bit
guests, but requires a kernel module parameter.
- Add an option to run 64-bit guests. Tested that the tests pass with that. As mentioned
this requires KVM nested virtualization.
2019-05-04 15:18:39 +01:00
|
|
|
unpackPhase = ''
|
2018-08-20 20:11:29 +01:00
|
|
|
${if stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux" then ''
|
2011-02-02 20:05:47 +00:00
|
|
|
isoinfo -J -i $src -x /VBoxLinuxAdditions.run > ./VBoxLinuxAdditions.run
|
|
|
|
chmod 755 ./VBoxLinuxAdditions.run
|
2019-10-07 12:58:39 +01:00
|
|
|
# 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
|
2012-08-14 18:43:37 +01:00
|
|
|
./VBoxLinuxAdditions.run --noexec --keep
|
2009-10-14 13:37:52 +01:00
|
|
|
''
|
2018-08-20 20:11:29 +01:00
|
|
|
else throw ("Architecture: "+stdenv.hostPlatform.system+" not supported for VirtualBox guest additions")
|
2009-10-14 13:37:52 +01:00
|
|
|
}
|
2012-08-14 18:43:37 +01:00
|
|
|
|
2010-02-16 16:10:01 +00:00
|
|
|
# Unpack files
|
|
|
|
cd install
|
2018-08-20 20:11:29 +01:00
|
|
|
${if stdenv.hostPlatform.system == "i686-linux" then ''
|
2011-02-02 20:05:47 +00:00
|
|
|
tar xfvj VBoxGuestAdditions-x86.tar.bz2
|
|
|
|
''
|
2018-08-20 20:11:29 +01:00
|
|
|
else if stdenv.hostPlatform.system == "x86_64-linux" then ''
|
2011-02-02 20:05:47 +00:00
|
|
|
tar xfvj VBoxGuestAdditions-amd64.tar.bz2
|
|
|
|
''
|
2018-08-20 20:11:29 +01:00
|
|
|
else throw ("Architecture: "+stdenv.hostPlatform.system+" not supported for VirtualBox guest additions")
|
2011-02-02 20:05:47 +00:00
|
|
|
}
|
virtualbox: 5.2.28 -> 6.0.6
Quite some fixing was needed to get this to work.
Changes in VirtualBox and additions:
- VirtualBox is no longer officially supported on 32-bit hosts so i686-linux is removed from platforms
for VirtualBox and the extension pack. 32-bit additions still work.
- There was a refactoring of kernel module makefiles and two resulting bugs affected us which had to be patched.
These bugs were reported to the bug tracker (see comments near patches).
- The Qt5X11Extras makefile patch broke. Fixed it to apply again, making the libraries logic simpler
and more correct (it just uses a different base path instead of always linking to Qt5X11Extras).
- Added a patch to remove "test1" and "test2" kernel messages due to forgotten debugging code.
- virtualbox-host NixOS module: the VirtualBoxVM executable should be setuid not VirtualBox.
This matches how the official installer sets it up.
- Additions: replaced a for loop for installing kernel modules with just a "make install",
which seems to work without any of the things done in the previous code.
- Additions: The package defined buildCommand which resulted in phases not running, including RUNPATH
stripping in fixupPhase, and installPhase was defined which was not even run. Fixed this by
refactoring using phases. Had to set dontStrip otherwise binaries were broken by stripping.
The libdbus path had to be added later in fixupPhase because it is used via dlopen not directly linked.
- Additions: Added zlib and libc to patchelf, otherwise runtime library errors result from some binaries.
For some reason the missing libc only manifested itself for mount.vboxsf when included in the initrd.
Changes in nixos/tests/virtualbox:
- Update the simple-gui test to send the right keys to start the VM. With VirtualBox 5
it was enough to just send "return", but with 6 the Tools thing may be selected by
default. Send "home" to reliably select Tools, "down" to move to the VM and "return"
to start it.
- Disable the VirtualBox UART by default because it causes a crash due to a regression
in VirtualBox (specific to software virtualization and serial port usage). It can
still be enabled using an option but there is an assert that KVM nested virtualization
is enabled, which works around the problem (see below).
- Add an option to enable nested KVM virtualization, allowing VirtualBox to use hardware
virtualization. This works around the UART problem and also allows using 64-bit
guests, but requires a kernel module parameter.
- Add an option to run 64-bit guests. Tested that the tests pass with that. As mentioned
this requires KVM nested virtualization.
2019-05-04 15:18:39 +01:00
|
|
|
'';
|
2011-02-02 20:05:47 +00:00
|
|
|
|
virtualbox: 5.2.28 -> 6.0.6
Quite some fixing was needed to get this to work.
Changes in VirtualBox and additions:
- VirtualBox is no longer officially supported on 32-bit hosts so i686-linux is removed from platforms
for VirtualBox and the extension pack. 32-bit additions still work.
- There was a refactoring of kernel module makefiles and two resulting bugs affected us which had to be patched.
These bugs were reported to the bug tracker (see comments near patches).
- The Qt5X11Extras makefile patch broke. Fixed it to apply again, making the libraries logic simpler
and more correct (it just uses a different base path instead of always linking to Qt5X11Extras).
- Added a patch to remove "test1" and "test2" kernel messages due to forgotten debugging code.
- virtualbox-host NixOS module: the VirtualBoxVM executable should be setuid not VirtualBox.
This matches how the official installer sets it up.
- Additions: replaced a for loop for installing kernel modules with just a "make install",
which seems to work without any of the things done in the previous code.
- Additions: The package defined buildCommand which resulted in phases not running, including RUNPATH
stripping in fixupPhase, and installPhase was defined which was not even run. Fixed this by
refactoring using phases. Had to set dontStrip otherwise binaries were broken by stripping.
The libdbus path had to be added later in fixupPhase because it is used via dlopen not directly linked.
- Additions: Added zlib and libc to patchelf, otherwise runtime library errors result from some binaries.
For some reason the missing libc only manifested itself for mount.vboxsf when included in the initrd.
Changes in nixos/tests/virtualbox:
- Update the simple-gui test to send the right keys to start the VM. With VirtualBox 5
it was enough to just send "return", but with 6 the Tools thing may be selected by
default. Send "home" to reliably select Tools, "down" to move to the VM and "return"
to start it.
- Disable the VirtualBox UART by default because it causes a crash due to a regression
in VirtualBox (specific to software virtualization and serial port usage). It can
still be enabled using an option but there is an assert that KVM nested virtualization
is enabled, which works around the problem (see below).
- Add an option to enable nested KVM virtualization, allowing VirtualBox to use hardware
virtualization. This works around the UART problem and also allows using 64-bit
guests, but requires a kernel module parameter.
- Add an option to run 64-bit guests. Tested that the tests pass with that. As mentioned
this requires KVM nested virtualization.
2019-05-04 15:18:39 +01:00
|
|
|
buildPhase = ''
|
|
|
|
# Build kernel modules.
|
|
|
|
cd src
|
2017-11-15 15:03:44 +00:00
|
|
|
find . -type f | xargs sed 's/depmod -a/true/' -i
|
|
|
|
cd vboxguest-${version}
|
virtualbox: 5.2.28 -> 6.0.6
Quite some fixing was needed to get this to work.
Changes in VirtualBox and additions:
- VirtualBox is no longer officially supported on 32-bit hosts so i686-linux is removed from platforms
for VirtualBox and the extension pack. 32-bit additions still work.
- There was a refactoring of kernel module makefiles and two resulting bugs affected us which had to be patched.
These bugs were reported to the bug tracker (see comments near patches).
- The Qt5X11Extras makefile patch broke. Fixed it to apply again, making the libraries logic simpler
and more correct (it just uses a different base path instead of always linking to Qt5X11Extras).
- Added a patch to remove "test1" and "test2" kernel messages due to forgotten debugging code.
- virtualbox-host NixOS module: the VirtualBoxVM executable should be setuid not VirtualBox.
This matches how the official installer sets it up.
- Additions: replaced a for loop for installing kernel modules with just a "make install",
which seems to work without any of the things done in the previous code.
- Additions: The package defined buildCommand which resulted in phases not running, including RUNPATH
stripping in fixupPhase, and installPhase was defined which was not even run. Fixed this by
refactoring using phases. Had to set dontStrip otherwise binaries were broken by stripping.
The libdbus path had to be added later in fixupPhase because it is used via dlopen not directly linked.
- Additions: Added zlib and libc to patchelf, otherwise runtime library errors result from some binaries.
For some reason the missing libc only manifested itself for mount.vboxsf when included in the initrd.
Changes in nixos/tests/virtualbox:
- Update the simple-gui test to send the right keys to start the VM. With VirtualBox 5
it was enough to just send "return", but with 6 the Tools thing may be selected by
default. Send "home" to reliably select Tools, "down" to move to the VM and "return"
to start it.
- Disable the VirtualBox UART by default because it causes a crash due to a regression
in VirtualBox (specific to software virtualization and serial port usage). It can
still be enabled using an option but there is an assert that KVM nested virtualization
is enabled, which works around the problem (see below).
- Add an option to enable nested KVM virtualization, allowing VirtualBox to use hardware
virtualization. This works around the UART problem and also allows using 64-bit
guests, but requires a kernel module parameter.
- Add an option to run 64-bit guests. Tested that the tests pass with that. As mentioned
this requires KVM nested virtualization.
2019-05-04 15:18:39 +01:00
|
|
|
# Run just make first. If we only did make install, we get symbol warnings during build.
|
2017-11-15 15:03:44 +00:00
|
|
|
make
|
|
|
|
cd ../..
|
2012-08-14 18:43:37 +01:00
|
|
|
|
2009-10-13 14:32:00 +01:00
|
|
|
# Change the interpreter for various binaries
|
virtualbox: 5.2.28 -> 6.0.6
Quite some fixing was needed to get this to work.
Changes in VirtualBox and additions:
- VirtualBox is no longer officially supported on 32-bit hosts so i686-linux is removed from platforms
for VirtualBox and the extension pack. 32-bit additions still work.
- There was a refactoring of kernel module makefiles and two resulting bugs affected us which had to be patched.
These bugs were reported to the bug tracker (see comments near patches).
- The Qt5X11Extras makefile patch broke. Fixed it to apply again, making the libraries logic simpler
and more correct (it just uses a different base path instead of always linking to Qt5X11Extras).
- Added a patch to remove "test1" and "test2" kernel messages due to forgotten debugging code.
- virtualbox-host NixOS module: the VirtualBoxVM executable should be setuid not VirtualBox.
This matches how the official installer sets it up.
- Additions: replaced a for loop for installing kernel modules with just a "make install",
which seems to work without any of the things done in the previous code.
- Additions: The package defined buildCommand which resulted in phases not running, including RUNPATH
stripping in fixupPhase, and installPhase was defined which was not even run. Fixed this by
refactoring using phases. Had to set dontStrip otherwise binaries were broken by stripping.
The libdbus path had to be added later in fixupPhase because it is used via dlopen not directly linked.
- Additions: Added zlib and libc to patchelf, otherwise runtime library errors result from some binaries.
For some reason the missing libc only manifested itself for mount.vboxsf when included in the initrd.
Changes in nixos/tests/virtualbox:
- Update the simple-gui test to send the right keys to start the VM. With VirtualBox 5
it was enough to just send "return", but with 6 the Tools thing may be selected by
default. Send "home" to reliably select Tools, "down" to move to the VM and "return"
to start it.
- Disable the VirtualBox UART by default because it causes a crash due to a regression
in VirtualBox (specific to software virtualization and serial port usage). It can
still be enabled using an option but there is an assert that KVM nested virtualization
is enabled, which works around the problem (see below).
- Add an option to enable nested KVM virtualization, allowing VirtualBox to use hardware
virtualization. This works around the UART problem and also allows using 64-bit
guests, but requires a kernel module parameter.
- Add an option to run 64-bit guests. Tested that the tests pass with that. As mentioned
this requires KVM nested virtualization.
2019-05-04 15:18:39 +01:00
|
|
|
for i in sbin/VBoxService bin/{VBoxClient,VBoxControl} other/mount.vboxsf; do
|
|
|
|
patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} $i
|
|
|
|
patchelf --set-rpath ${lib.makeLibraryPath [ stdenv.cc.cc stdenv.cc.libc zlib
|
|
|
|
xorg.libX11 xorg.libXt xorg.libXext xorg.libXmu xorg.libXfixes xorg.libXrandr xorg.libXcursor ]} $i
|
2009-10-13 14:32:00 +01:00
|
|
|
done
|
|
|
|
|
2010-02-16 16:10:01 +00:00
|
|
|
for i in lib/VBoxOGL*.so
|
2009-10-13 14:32:00 +01:00
|
|
|
do
|
virtualbox: 5.2.28 -> 6.0.6
Quite some fixing was needed to get this to work.
Changes in VirtualBox and additions:
- VirtualBox is no longer officially supported on 32-bit hosts so i686-linux is removed from platforms
for VirtualBox and the extension pack. 32-bit additions still work.
- There was a refactoring of kernel module makefiles and two resulting bugs affected us which had to be patched.
These bugs were reported to the bug tracker (see comments near patches).
- The Qt5X11Extras makefile patch broke. Fixed it to apply again, making the libraries logic simpler
and more correct (it just uses a different base path instead of always linking to Qt5X11Extras).
- Added a patch to remove "test1" and "test2" kernel messages due to forgotten debugging code.
- virtualbox-host NixOS module: the VirtualBoxVM executable should be setuid not VirtualBox.
This matches how the official installer sets it up.
- Additions: replaced a for loop for installing kernel modules with just a "make install",
which seems to work without any of the things done in the previous code.
- Additions: The package defined buildCommand which resulted in phases not running, including RUNPATH
stripping in fixupPhase, and installPhase was defined which was not even run. Fixed this by
refactoring using phases. Had to set dontStrip otherwise binaries were broken by stripping.
The libdbus path had to be added later in fixupPhase because it is used via dlopen not directly linked.
- Additions: Added zlib and libc to patchelf, otherwise runtime library errors result from some binaries.
For some reason the missing libc only manifested itself for mount.vboxsf when included in the initrd.
Changes in nixos/tests/virtualbox:
- Update the simple-gui test to send the right keys to start the VM. With VirtualBox 5
it was enough to just send "return", but with 6 the Tools thing may be selected by
default. Send "home" to reliably select Tools, "down" to move to the VM and "return"
to start it.
- Disable the VirtualBox UART by default because it causes a crash due to a regression
in VirtualBox (specific to software virtualization and serial port usage). It can
still be enabled using an option but there is an assert that KVM nested virtualization
is enabled, which works around the problem (see below).
- Add an option to enable nested KVM virtualization, allowing VirtualBox to use hardware
virtualization. This works around the UART problem and also allows using 64-bit
guests, but requires a kernel module parameter.
- Add an option to run 64-bit guests. Tested that the tests pass with that. As mentioned
this requires KVM nested virtualization.
2019-05-04 15:18:39 +01:00
|
|
|
patchelf --set-rpath ${lib.makeLibraryPath [ "$out"
|
|
|
|
xorg.libXcomposite xorg.libXdamage xorg.libXext xorg.libXfixes ]} $i
|
2009-10-13 14:32:00 +01:00
|
|
|
done
|
2012-08-14 18:43:37 +01:00
|
|
|
|
2015-03-02 14:56:32 +00:00
|
|
|
# FIXME: Virtualbox 4.3.22 moved VBoxClient-all (required by Guest Additions
|
|
|
|
# NixOS module) to 98vboxadd-xclient. For now, just work around it:
|
2017-11-15 15:03:44 +00:00
|
|
|
mv other/98vboxadd-xclient bin/VBoxClient-all
|
2015-03-02 14:56:32 +00:00
|
|
|
|
2009-10-13 14:32:00 +01:00
|
|
|
# Remove references to /usr from various scripts and files
|
2017-11-15 15:03:44 +00:00
|
|
|
sed -i -e "s|/usr/bin|$out/bin|" other/vboxclient.desktop
|
2010-02-16 16:10:01 +00:00
|
|
|
sed -i -e "s|/usr/bin|$out/bin|" bin/VBoxClient-all
|
virtualbox: 5.2.28 -> 6.0.6
Quite some fixing was needed to get this to work.
Changes in VirtualBox and additions:
- VirtualBox is no longer officially supported on 32-bit hosts so i686-linux is removed from platforms
for VirtualBox and the extension pack. 32-bit additions still work.
- There was a refactoring of kernel module makefiles and two resulting bugs affected us which had to be patched.
These bugs were reported to the bug tracker (see comments near patches).
- The Qt5X11Extras makefile patch broke. Fixed it to apply again, making the libraries logic simpler
and more correct (it just uses a different base path instead of always linking to Qt5X11Extras).
- Added a patch to remove "test1" and "test2" kernel messages due to forgotten debugging code.
- virtualbox-host NixOS module: the VirtualBoxVM executable should be setuid not VirtualBox.
This matches how the official installer sets it up.
- Additions: replaced a for loop for installing kernel modules with just a "make install",
which seems to work without any of the things done in the previous code.
- Additions: The package defined buildCommand which resulted in phases not running, including RUNPATH
stripping in fixupPhase, and installPhase was defined which was not even run. Fixed this by
refactoring using phases. Had to set dontStrip otherwise binaries were broken by stripping.
The libdbus path had to be added later in fixupPhase because it is used via dlopen not directly linked.
- Additions: Added zlib and libc to patchelf, otherwise runtime library errors result from some binaries.
For some reason the missing libc only manifested itself for mount.vboxsf when included in the initrd.
Changes in nixos/tests/virtualbox:
- Update the simple-gui test to send the right keys to start the VM. With VirtualBox 5
it was enough to just send "return", but with 6 the Tools thing may be selected by
default. Send "home" to reliably select Tools, "down" to move to the VM and "return"
to start it.
- Disable the VirtualBox UART by default because it causes a crash due to a regression
in VirtualBox (specific to software virtualization and serial port usage). It can
still be enabled using an option but there is an assert that KVM nested virtualization
is enabled, which works around the problem (see below).
- Add an option to enable nested KVM virtualization, allowing VirtualBox to use hardware
virtualization. This works around the UART problem and also allows using 64-bit
guests, but requires a kernel module parameter.
- Add an option to run 64-bit guests. Tested that the tests pass with that. As mentioned
this requires KVM nested virtualization.
2019-05-04 15:18:39 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
# Install kernel modules.
|
|
|
|
cd src/vboxguest-${version}
|
|
|
|
make install INSTALL_MOD_PATH=$out
|
|
|
|
cd ../..
|
2012-08-14 18:43:37 +01:00
|
|
|
|
2009-10-13 14:32:00 +01:00
|
|
|
# Install binaries
|
2017-11-15 15:03:44 +00:00
|
|
|
install -D -m 755 other/mount.vboxsf $out/bin/mount.vboxsf
|
2015-08-04 02:03:24 +01:00
|
|
|
install -D -m 755 sbin/VBoxService $out/bin/VBoxService
|
2009-10-13 14:32:00 +01:00
|
|
|
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/bin
|
2010-02-16 16:10:01 +00:00
|
|
|
install -m 755 bin/VBoxClient $out/bin
|
|
|
|
install -m 755 bin/VBoxControl $out/bin
|
|
|
|
install -m 755 bin/VBoxClient-all $out/bin
|
2009-10-13 14:32:00 +01:00
|
|
|
|
2010-11-28 10:14:07 +00:00
|
|
|
wrapProgram $out/bin/VBoxClient-all \
|
|
|
|
--prefix PATH : "${which}/bin"
|
|
|
|
|
2019-05-23 13:18:23 +01:00
|
|
|
# Don't install VBoxOGL for now
|
|
|
|
# It seems to be broken upstream too, and fixing it is far down the priority list:
|
|
|
|
# https://www.virtualbox.org/pipermail/vbox-dev/2017-June/014561.html
|
|
|
|
# Additionally, 3d support seems to rely on VBoxOGL.so being symlinked from
|
|
|
|
# libGL.so (which we can't), and Oracle doesn't plan on supporting libglvnd
|
|
|
|
# either. (#18457)
|
|
|
|
## Install OpenGL libraries
|
|
|
|
#mkdir -p $out/lib
|
|
|
|
#cp -v lib/VBoxOGL*.so $out/lib
|
|
|
|
#mkdir -p $out/lib/dri
|
|
|
|
#ln -s $out/lib/VBoxOGL.so $out/lib/dri/vboxvideo_dri.so
|
2012-08-14 18:43:37 +01:00
|
|
|
|
2009-10-13 14:32:00 +01:00
|
|
|
# Install desktop file
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/share/autostart
|
2017-11-15 15:03:44 +00:00
|
|
|
cp -v other/vboxclient.desktop $out/share/autostart
|
2012-04-23 05:25:18 +01:00
|
|
|
|
2009-10-13 14:32:00 +01:00
|
|
|
# Install Xorg drivers
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/lib/xorg/modules/{drivers,input}
|
2017-11-15 15:03:44 +00:00
|
|
|
install -m 644 other/vboxvideo_drv_${xserverABI}.so $out/lib/xorg/modules/drivers/vboxvideo_drv.so
|
virtualbox: 5.2.28 -> 6.0.6
Quite some fixing was needed to get this to work.
Changes in VirtualBox and additions:
- VirtualBox is no longer officially supported on 32-bit hosts so i686-linux is removed from platforms
for VirtualBox and the extension pack. 32-bit additions still work.
- There was a refactoring of kernel module makefiles and two resulting bugs affected us which had to be patched.
These bugs were reported to the bug tracker (see comments near patches).
- The Qt5X11Extras makefile patch broke. Fixed it to apply again, making the libraries logic simpler
and more correct (it just uses a different base path instead of always linking to Qt5X11Extras).
- Added a patch to remove "test1" and "test2" kernel messages due to forgotten debugging code.
- virtualbox-host NixOS module: the VirtualBoxVM executable should be setuid not VirtualBox.
This matches how the official installer sets it up.
- Additions: replaced a for loop for installing kernel modules with just a "make install",
which seems to work without any of the things done in the previous code.
- Additions: The package defined buildCommand which resulted in phases not running, including RUNPATH
stripping in fixupPhase, and installPhase was defined which was not even run. Fixed this by
refactoring using phases. Had to set dontStrip otherwise binaries were broken by stripping.
The libdbus path had to be added later in fixupPhase because it is used via dlopen not directly linked.
- Additions: Added zlib and libc to patchelf, otherwise runtime library errors result from some binaries.
For some reason the missing libc only manifested itself for mount.vboxsf when included in the initrd.
Changes in nixos/tests/virtualbox:
- Update the simple-gui test to send the right keys to start the VM. With VirtualBox 5
it was enough to just send "return", but with 6 the Tools thing may be selected by
default. Send "home" to reliably select Tools, "down" to move to the VM and "return"
to start it.
- Disable the VirtualBox UART by default because it causes a crash due to a regression
in VirtualBox (specific to software virtualization and serial port usage). It can
still be enabled using an option but there is an assert that KVM nested virtualization
is enabled, which works around the problem (see below).
- Add an option to enable nested KVM virtualization, allowing VirtualBox to use hardware
virtualization. This works around the UART problem and also allows using 64-bit
guests, but requires a kernel module parameter.
- Add an option to run 64-bit guests. Tested that the tests pass with that. As mentioned
this requires KVM nested virtualization.
2019-05-04 15:18:39 +01:00
|
|
|
'';
|
2012-04-23 05:25:18 +01:00
|
|
|
|
virtualbox: 5.2.28 -> 6.0.6
Quite some fixing was needed to get this to work.
Changes in VirtualBox and additions:
- VirtualBox is no longer officially supported on 32-bit hosts so i686-linux is removed from platforms
for VirtualBox and the extension pack. 32-bit additions still work.
- There was a refactoring of kernel module makefiles and two resulting bugs affected us which had to be patched.
These bugs were reported to the bug tracker (see comments near patches).
- The Qt5X11Extras makefile patch broke. Fixed it to apply again, making the libraries logic simpler
and more correct (it just uses a different base path instead of always linking to Qt5X11Extras).
- Added a patch to remove "test1" and "test2" kernel messages due to forgotten debugging code.
- virtualbox-host NixOS module: the VirtualBoxVM executable should be setuid not VirtualBox.
This matches how the official installer sets it up.
- Additions: replaced a for loop for installing kernel modules with just a "make install",
which seems to work without any of the things done in the previous code.
- Additions: The package defined buildCommand which resulted in phases not running, including RUNPATH
stripping in fixupPhase, and installPhase was defined which was not even run. Fixed this by
refactoring using phases. Had to set dontStrip otherwise binaries were broken by stripping.
The libdbus path had to be added later in fixupPhase because it is used via dlopen not directly linked.
- Additions: Added zlib and libc to patchelf, otherwise runtime library errors result from some binaries.
For some reason the missing libc only manifested itself for mount.vboxsf when included in the initrd.
Changes in nixos/tests/virtualbox:
- Update the simple-gui test to send the right keys to start the VM. With VirtualBox 5
it was enough to just send "return", but with 6 the Tools thing may be selected by
default. Send "home" to reliably select Tools, "down" to move to the VM and "return"
to start it.
- Disable the VirtualBox UART by default because it causes a crash due to a regression
in VirtualBox (specific to software virtualization and serial port usage). It can
still be enabled using an option but there is an assert that KVM nested virtualization
is enabled, which works around the problem (see below).
- Add an option to enable nested KVM virtualization, allowing VirtualBox to use hardware
virtualization. This works around the UART problem and also allows using 64-bit
guests, but requires a kernel module parameter.
- Add an option to run 64-bit guests. Tested that the tests pass with that. As mentioned
this requires KVM nested virtualization.
2019-05-04 15:18:39 +01:00
|
|
|
# Stripping breaks these binaries for some reason.
|
|
|
|
dontStrip = true;
|
2012-08-14 18:43:37 +01:00
|
|
|
|
2019-09-23 17:06:15 +01:00
|
|
|
# Patch RUNPATH according to dlopenLibs (see the comment there).
|
|
|
|
postFixup = lib.concatMapStrings (library: ''
|
|
|
|
for i in $(grep -F ${lib.escapeShellArg library.name} -l -r $out/{lib,bin}); do
|
virtualbox: 5.2.28 -> 6.0.6
Quite some fixing was needed to get this to work.
Changes in VirtualBox and additions:
- VirtualBox is no longer officially supported on 32-bit hosts so i686-linux is removed from platforms
for VirtualBox and the extension pack. 32-bit additions still work.
- There was a refactoring of kernel module makefiles and two resulting bugs affected us which had to be patched.
These bugs were reported to the bug tracker (see comments near patches).
- The Qt5X11Extras makefile patch broke. Fixed it to apply again, making the libraries logic simpler
and more correct (it just uses a different base path instead of always linking to Qt5X11Extras).
- Added a patch to remove "test1" and "test2" kernel messages due to forgotten debugging code.
- virtualbox-host NixOS module: the VirtualBoxVM executable should be setuid not VirtualBox.
This matches how the official installer sets it up.
- Additions: replaced a for loop for installing kernel modules with just a "make install",
which seems to work without any of the things done in the previous code.
- Additions: The package defined buildCommand which resulted in phases not running, including RUNPATH
stripping in fixupPhase, and installPhase was defined which was not even run. Fixed this by
refactoring using phases. Had to set dontStrip otherwise binaries were broken by stripping.
The libdbus path had to be added later in fixupPhase because it is used via dlopen not directly linked.
- Additions: Added zlib and libc to patchelf, otherwise runtime library errors result from some binaries.
For some reason the missing libc only manifested itself for mount.vboxsf when included in the initrd.
Changes in nixos/tests/virtualbox:
- Update the simple-gui test to send the right keys to start the VM. With VirtualBox 5
it was enough to just send "return", but with 6 the Tools thing may be selected by
default. Send "home" to reliably select Tools, "down" to move to the VM and "return"
to start it.
- Disable the VirtualBox UART by default because it causes a crash due to a regression
in VirtualBox (specific to software virtualization and serial port usage). It can
still be enabled using an option but there is an assert that KVM nested virtualization
is enabled, which works around the problem (see below).
- Add an option to enable nested KVM virtualization, allowing VirtualBox to use hardware
virtualization. This works around the UART problem and also allows using 64-bit
guests, but requires a kernel module parameter.
- Add an option to run 64-bit guests. Tested that the tests pass with that. As mentioned
this requires KVM nested virtualization.
2019-05-04 15:18:39 +01:00
|
|
|
origRpath=$(patchelf --print-rpath "$i")
|
2019-09-23 17:06:15 +01:00
|
|
|
patchelf --set-rpath "$origRpath:${lib.makeLibraryPath [ library.pkg ]}" "$i"
|
2012-08-14 18:43:37 +01:00
|
|
|
done
|
2019-09-23 17:06:15 +01:00
|
|
|
'') dlopenLibs;
|
2012-08-14 18:43:37 +01:00
|
|
|
|
2009-10-13 14:32:00 +01:00
|
|
|
meta = {
|
|
|
|
description = "Guest additions for VirtualBox";
|
2017-04-29 22:12:20 +01:00
|
|
|
longDescription = ''
|
2009-10-13 14:32:00 +01:00
|
|
|
Various add-ons which makes NixOS work better as guest OS inside VirtualBox.
|
|
|
|
This add-on provides support for dynamic resizing of the X Display, shared
|
|
|
|
host/guest clipboard support and guest OpenGL support.
|
|
|
|
'';
|
|
|
|
license = "GPL";
|
|
|
|
maintainers = [ lib.maintainers.sander ];
|
2012-08-14 18:43:37 +01:00
|
|
|
platforms = lib.platforms.linux;
|
2009-10-13 14:32:00 +01:00
|
|
|
};
|
|
|
|
}
|