2009-10-13 15:32:00 +02:00
|
|
|
{ stdenv, fetchurl, lib, patchelf, cdrkit, kernel
|
2009-10-13 23:19:07 +02:00
|
|
|
, libX11, libXt, libXext, libXmu, libXcomposite, libXfixes}:
|
2009-10-13 15:32:00 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2009-11-06 12:41:34 +01:00
|
|
|
name = "VirtualBox-GuestAdditions-3.0.10";
|
2009-10-13 15:32:00 +02:00
|
|
|
src = fetchurl {
|
2009-11-06 12:41:34 +01:00
|
|
|
url = http://download.virtualbox.org/virtualbox/3.0.10/VBoxGuestAdditions_3.0.10.iso;
|
|
|
|
sha256 = "08m7n3127nwcla1ws744n1d2i2mz4s1k4460i2h6qyvgnrgz32yv";
|
2009-10-13 15:32:00 +02:00
|
|
|
};
|
|
|
|
KERN_DIR = "${kernel}/lib/modules/*/build";
|
|
|
|
buildInputs = [ patchelf cdrkit ];
|
|
|
|
buildCommand = ''
|
2009-10-14 14:37:52 +02:00
|
|
|
${if stdenv.system == "i686-linux" then ''
|
2009-10-14 17:26:42 +02:00
|
|
|
isoinfo -J -i $src -x /VBoxLinuxAdditions-x86.run > ./VBoxLinuxAdditions-x86.run
|
2009-10-14 14:37:52 +02:00
|
|
|
chmod 755 ./VBoxLinuxAdditions-x86.run
|
|
|
|
./VBoxLinuxAdditions-x86.run --noexec --keep
|
|
|
|
''
|
|
|
|
else if stdenv.system == "x86_64-linux" then ''
|
2009-10-14 17:26:42 +02:00
|
|
|
isoinfo -J -i $src -x /VBoxLinuxAdditions-amd64.run > ./VBoxLinuxAdditions-amd64.run
|
2009-10-14 14:37:52 +02:00
|
|
|
chmod 755 ./VBoxLinuxAdditions-amd64.run
|
|
|
|
./VBoxLinuxAdditions-amd64.run --noexec --keep
|
|
|
|
''
|
|
|
|
else throw ("Architecture: "+stdenv.system+" not supported for VirtualBox guest additions")
|
|
|
|
}
|
|
|
|
|
2009-10-13 15:32:00 +02:00
|
|
|
cd linux
|
|
|
|
|
|
|
|
# Build kernel modules
|
|
|
|
cd module
|
|
|
|
for i in `find . -name Makefile`
|
|
|
|
do
|
|
|
|
sed -i -e "s/depmod/echo/g" $i
|
|
|
|
done
|
|
|
|
make
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# Change the interpreter for various binaries
|
|
|
|
for i in ./{mount.vboxsf,vboxadd-service,VBoxClient,VBoxControl}
|
|
|
|
do
|
2009-10-14 14:37:52 +02:00
|
|
|
${if stdenv.system == "i686-linux" then ''
|
|
|
|
patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2 $i
|
|
|
|
''
|
|
|
|
else if stdenv.system == "x86_64-linux" then ''
|
|
|
|
patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $i
|
|
|
|
''
|
|
|
|
else throw ("Architecture: "+stdenv.system+" not supported for VirtualBox guest additions")
|
|
|
|
}
|
2009-10-13 15:32:00 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
# Change rpath for various binaries and libraries
|
2009-10-13 23:19:07 +02:00
|
|
|
patchelf --set-rpath ${stdenv.gcc.gcc}/lib:${libX11}/lib:${libXt}/lib:${libXext}/lib:${libXmu}/lib:${libXfixes}/lib ./VBoxClient
|
2009-10-13 15:32:00 +02:00
|
|
|
|
|
|
|
for i in ./VBoxOGL{arrayspu,errorspu,feedbackspu,packspu,passthroughspu}.so
|
|
|
|
do
|
|
|
|
patchelf --set-rpath $out/lib $i
|
|
|
|
done
|
|
|
|
|
|
|
|
patchelf --set-rpath $out/lib:${libXcomposite}/lib ./VBoxOGL.so
|
|
|
|
|
|
|
|
# Remove references to /usr from various scripts and files
|
|
|
|
sed -i -e "s|/usr/bin|$out/bin|" vboxclient.desktop
|
|
|
|
sed -i -e "s|/usr/bin|$out/bin|" 98vboxadd-xclient
|
|
|
|
|
|
|
|
# Install binaries
|
|
|
|
ensureDir $out/sbin
|
|
|
|
install -m 4755 mount.vboxsf $out/sbin/mount.vboxsf
|
|
|
|
install -m 755 vboxadd-service $out/sbin/vboxadd-service
|
|
|
|
|
|
|
|
ensureDir $out/bin
|
|
|
|
install -m 755 VBoxControl $out/bin/VBoxControl
|
|
|
|
install -m 755 VBoxClient $out/bin/VBoxClient
|
|
|
|
install -m 755 VBoxRandR.sh $out/bin/VBoxRandR
|
|
|
|
install -m 755 98vboxadd-xclient $out/bin/VBoxClient-all
|
|
|
|
|
|
|
|
# Install OpenGL libraries
|
|
|
|
ensureDir $out/lib
|
|
|
|
cp -v VBoxOGL*.so $out/lib
|
|
|
|
ensureDir $out/lib/dri
|
|
|
|
ln -s $out/lib/VBoxOGL.so $out/lib/dri/vboxvideo_dri.so
|
|
|
|
|
|
|
|
# Install desktop file
|
2009-10-13 17:04:43 +02:00
|
|
|
ensureDir $out/share/autostart
|
|
|
|
cp -v vboxclient.desktop $out/share/autostart
|
2009-10-13 15:32:00 +02:00
|
|
|
|
2009-10-13 16:29:38 +02:00
|
|
|
# Install HAL FDI file
|
|
|
|
ensureDir $out/share/hal/fdi/policy
|
|
|
|
install -m 644 90-vboxguest.fdi $out/share/hal/fdi/policy
|
|
|
|
|
2009-10-13 15:32:00 +02:00
|
|
|
# Install Xorg drivers
|
|
|
|
ensureDir $out/lib/xorg/modules/{drivers,input}
|
2009-11-06 12:41:34 +01:00
|
|
|
install -m 644 vboxvideo_drv_17.so $out/lib/xorg/modules/drivers/vboxvideo_drv.so
|
|
|
|
install -m 644 vboxmouse_drv_17.so $out/lib/xorg/modules/input/vboxmouse_drv.so
|
2009-10-13 15:32:00 +02:00
|
|
|
|
|
|
|
# Install kernel modules
|
|
|
|
cd module
|
|
|
|
kernelVersion=$(cd ${kernel}/lib/modules; ls)
|
|
|
|
export MODULE_DIR=$out/lib/modules/$kernelVersion/misc
|
|
|
|
ensureDir $MODULE_DIR
|
|
|
|
make install
|
|
|
|
cd vboxvideo_drm
|
|
|
|
make install
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Guest additions for VirtualBox";
|
|
|
|
longDescriptions = ''
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|