* NVIDIA driver: updated to 256.35. Unfortunately the unpacked driver

now has a flat directory structure (i.e. usr/lib, usr/share etc. are
  gone), which makes installing everything in the right location
  rather more tedious.

svn path=/nixpkgs/trunk/; revision=22628
This commit is contained in:
Eelco Dolstra 2010-07-18 20:21:18 +00:00
parent 5bd2be1d12
commit 5a7e3c70ce
2 changed files with 32 additions and 28 deletions

View file

@ -10,25 +10,16 @@ unpackFile() {
buildPhase() {
if test -z "$libsOnly"; then
echo "Building linux driver against kernel: " $kernel;
cd usr/src/nv/
# Workaround: get it to build on kernels that have CONFIG_XEN
# set. Disable the test, apply a patch to disable the Xen
# functionality.
#substituteInPlace Makefile.kbuild --replace xen_sanity_check fnord
#patch -p1 < $xenPatch
# Create the module.
echo "Building linux driver against kernel: $kernel";
cd kernel
kernelVersion=$(cd $kernel/lib/modules && ls)
sysSrc=$(echo $kernel/lib/modules/$kernelVersion/build/)
unset src # used by the nv makefile
# Hack necessary to compile on 2.6.28.
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$sysSrc/include/asm/mach-default"
make SYSSRC=$sysSrc module
cd ../../..
cd ..
fi
}
@ -37,10 +28,12 @@ installPhase() {
# Install libGL and friends.
ensureDir $out/lib
cp -prd usr/lib/* usr/X11R6/lib/libXv* $out/lib/
ln -snf libGLcore.so.$versionNumber $out/lib/libGLcore.so
ln -snf libGLcore.so.$versionNumber $out/lib/libGLcore.so.1
cp -prd libcuda.* libGL.* libnvidia-cfg.* libnvidia-compiler.* libnvidia-tls.* libnvidia-glcore.* libOpenCL.* libvdpau.* libXv* tls $out/lib/
ensureDir $out/lib/vdpau
cp -p libvdpau_* $out/lib/vdpau
ln -snf libnvidia-glcore.so.$versionNumber $out/lib/libnvidia-glcore.so
ln -snf libnvidia-glcore.so.$versionNumber $out/lib/libnvidia-glcore.so.1
ln -snf libGL.so.$versionNumber $out/lib/libGL.so
ln -snf libGL.so.$versionNumber $out/lib/libGL.so.1
ln -snf libnvidia-cfg.so.$versionNumber $out/lib/libnvidia-cfg.so.1
@ -51,20 +44,21 @@ installPhase() {
patchelf --set-rpath $out/lib:$glPath $out/lib/libGL.so.*.*
patchelf --set-rpath $out/lib:$glPath $out/lib/libXvMCNVIDIA.so.*.*
set +e
# Legacy nvidia doesn't have cuda
patchelf --set-rpath $cudaPath $out/lib/libcuda.so.*.*
set -e
if test -z "$libsOnly"; then
# Install the kernel module.
ensureDir $out/lib/modules/$kernelVersion/misc
cp usr/src/nv/nvidia.ko $out/lib/modules/$kernelVersion/misc
cp kernel/nvidia.ko $out/lib/modules/$kernelVersion/misc
# Install the X driver.
ensureDir $out/lib/xorg/modules
cp -prd usr/X11R6/lib/modules/* $out/lib/xorg/modules/
cp -p libnvidia-wfb.* $out/lib/xorg/modules/
ensureDir $out/lib/xorg/modules/drivers
cp -p nvidia_drv.so $out/lib/xorg/modules/drivers
ensureDir $out/lib/xorg/modules/extensions
cp -p libglx.so.* $out/lib/xorg/modules/extensions
ln -snf libnvidia-wfb.so.$versionNumber $out/lib/xorg/modules/libnvidia-wfb.so.1
ln -snf libglx.so.$versionNumber $out/lib/xorg/modules/extensions/libglx.so
@ -75,13 +69,23 @@ installPhase() {
ensureDir $out/bin
for i in nvidia-settings nvidia-xconfig; do
cp usr/bin/$i $out/bin/$i
cp $i $out/bin/$i
patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
--set-rpath $out/lib:$programPath:$glPath $out/bin/$i
done
# Header files etc.
cp -prd usr/include usr/share $out
ensureDir $out/include/nvidia
cp -p *.h $out/include/nvidia
ensureDir $out/share/man/man1
cp -p *.1.gz $out/share/man/man1
ensureDir $out/share/applications
cp -p *.desktop $out/share/applications
ensureDir $out/share/pixmaps
cp -p nvidia-settings.png $out/share/pixmaps
# Patch the `nvidia-settings.desktop' file.
substituteInPlace $out/share/applications/nvidia-settings.desktop \

View file

@ -7,7 +7,7 @@
with stdenv.lib;
let versionNumber = "195.36.24"; in
let versionNumber = "256.35"; in
stdenv.mkDerivation {
name = "nvidia-x11-${versionNumber}${optionalString (!libsOnly) "-${kernel.version}"}";
@ -17,13 +17,13 @@ stdenv.mkDerivation {
src =
if stdenv.system == "i686-linux" then
fetchurl {
url = "http://us.download.nvidia.com/XFree86/Linux-x86/${versionNumber}/NVIDIA-Linux-x86-${versionNumber}-pkg0.run";
sha256 = "0h96356jmmk283ijq30zimp3wxldsaddrk03gy3jifj1v29iklcg";
url = "http://us.download.nvidia.com/XFree86/Linux-x86/${versionNumber}/NVIDIA-Linux-x86-${versionNumber}.run";
sha256 = "0qpn9i1z3b0zafpk97inmhr21wp93pjf76z9jxrxhi3jzkbbdxla";
}
else if stdenv.system == "x86_64-linux" then
fetchurl {
url = "http://us.download.nvidia.com/XFree86/Linux-x86_64/${versionNumber}/NVIDIA-Linux-x86_64-${versionNumber}-pkg0.run";
sha256 = "1car62fgzy4gvgmqjywbdpascrasqwv3knlyw6zzr7r84qabzc1a";
url = "http://us.download.nvidia.com/XFree86/Linux-x86_64/${versionNumber}/NVIDIA-Linux-x86_64-${versionNumber}-no-compat32.run";
sha256 = "0in4b9k0nlbvnxrnh1v1d8m24wyljanymyh6w86yvirp24b4wang";
}
else throw "nvidia-x11 does not support platform ${stdenv.system}";