2015-09-15 02:26:18 -07:00
|
|
|
{ stdenv, fetchurl, kernel ? null, xorg, zlib, perl
|
2016-09-11 14:24:51 -07:00
|
|
|
, gtk2, atk, pango, glib, gdk_pixbuf, cairo, nukeReferences
|
2014-12-23 15:01:04 -08:00
|
|
|
, # Whether to build the libraries only (i.e. not the kernel module or
|
|
|
|
# nvidia-settings). Used to support 32-bit binaries on 64-bit
|
|
|
|
# Linux.
|
|
|
|
libsOnly ? false
|
|
|
|
}:
|
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
assert (!libsOnly) -> kernel != null;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2016-12-23 01:57:28 -08:00
|
|
|
versionNumber = "375.26";
|
2015-02-28 04:52:58 -08:00
|
|
|
|
2014-12-23 15:49:59 -08:00
|
|
|
# Policy: use the highest stable version as the default (on our master).
|
2014-12-23 15:01:04 -08:00
|
|
|
inherit (stdenv.lib) makeLibraryPath;
|
2015-02-28 04:52:58 -08:00
|
|
|
|
2016-10-11 16:42:33 -07:00
|
|
|
nameSuffix = optionalString (!libsOnly) "-${kernel.version}";
|
|
|
|
|
2014-12-23 15:01:04 -08:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2016-10-11 16:42:33 -07:00
|
|
|
name = "nvidia-x11-${versionNumber}${nameSuffix}";
|
2014-12-23 15:01:04 -08:00
|
|
|
|
|
|
|
builder = ./builder.sh;
|
|
|
|
|
|
|
|
src =
|
|
|
|
if stdenv.system == "i686-linux" then
|
|
|
|
fetchurl {
|
2016-10-16 08:04:05 -07:00
|
|
|
url = "http://download.nvidia.com/XFree86/Linux-x86/${versionNumber}/NVIDIA-Linux-x86-${versionNumber}.run";
|
2016-12-23 01:57:28 -08:00
|
|
|
sha256 = "0yv19rkz2wzzj0fygfjb1mh21iy769kff3yg2kzk8bsiwnmcyybw";
|
2014-12-23 15:01:04 -08:00
|
|
|
}
|
|
|
|
else if stdenv.system == "x86_64-linux" then
|
|
|
|
fetchurl {
|
2016-10-16 08:04:05 -07:00
|
|
|
url = "http://download.nvidia.com/XFree86/Linux-x86_64/${versionNumber}/NVIDIA-Linux-x86_64-${versionNumber}.run";
|
2016-12-23 01:57:28 -08:00
|
|
|
sha256 = "1kqy9ayja3g5znj2hzx8pklz8qi0b0l9da7c3ldg3hlxf31v4hjg";
|
2014-12-23 15:01:04 -08:00
|
|
|
}
|
|
|
|
else throw "nvidia-x11 does not support platform ${stdenv.system}";
|
|
|
|
|
|
|
|
inherit versionNumber libsOnly;
|
2015-07-30 05:07:45 -07:00
|
|
|
inherit (stdenv) system;
|
2014-12-23 15:01:04 -08:00
|
|
|
|
|
|
|
kernel = if libsOnly then null else kernel.dev;
|
|
|
|
|
2016-08-13 07:49:42 -07:00
|
|
|
hardeningDisable = [ "pic" "format" ];
|
|
|
|
|
2014-12-23 15:01:04 -08:00
|
|
|
dontStrip = true;
|
|
|
|
|
2015-09-15 02:26:18 -07:00
|
|
|
glPath = makeLibraryPath [xorg.libXext xorg.libX11 xorg.libXrandr];
|
2015-01-14 20:25:26 -08:00
|
|
|
cudaPath = makeLibraryPath [zlib stdenv.cc.cc];
|
2014-12-23 15:01:04 -08:00
|
|
|
openclPath = makeLibraryPath [zlib];
|
2015-09-15 02:26:18 -07:00
|
|
|
allLibPath = makeLibraryPath [xorg.libXext xorg.libX11 xorg.libXrandr zlib stdenv.cc.cc];
|
2014-12-23 15:01:04 -08:00
|
|
|
|
2015-02-28 04:49:25 -08:00
|
|
|
gtkPath = optionalString (!libsOnly) (makeLibraryPath
|
2016-09-11 14:24:51 -07:00
|
|
|
[ gtk2 atk pango glib gdk_pixbuf cairo ] );
|
2015-09-15 02:26:18 -07:00
|
|
|
programPath = makeLibraryPath [ xorg.libXv ];
|
2014-12-23 15:01:04 -08:00
|
|
|
|
2016-10-11 16:42:33 -07:00
|
|
|
|
2016-08-01 06:44:04 -07:00
|
|
|
|
2015-07-26 03:11:17 -07:00
|
|
|
buildInputs = [ perl nukeReferences ];
|
|
|
|
|
|
|
|
disallowedReferences = if libsOnly then [] else [ kernel.dev ];
|
2014-12-23 15:01:04 -08:00
|
|
|
|
|
|
|
meta = with stdenv.lib.meta; {
|
|
|
|
homepage = http://www.nvidia.com/object/unix.html;
|
|
|
|
description = "X.org driver and kernel module for NVIDIA graphics cards";
|
|
|
|
license = licenses.unfreeRedistributable;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.vcunat ];
|
2015-08-24 15:37:54 -07:00
|
|
|
priority = 4; # resolves collision with xorg-server's "lib/xorg/modules/extensions/libglx.so"
|
2014-12-23 15:01:04 -08:00
|
|
|
};
|
|
|
|
}
|