2017-01-29 21:29:39 +00:00
|
|
|
{ version
|
2018-08-11 16:32:00 +01:00
|
|
|
, sha256_32bit ? null
|
2017-01-29 21:29:39 +00:00
|
|
|
, sha256_64bit
|
|
|
|
, settingsSha256
|
|
|
|
, persistencedSha256
|
|
|
|
, useGLVND ? true
|
2017-02-11 14:11:18 +00:00
|
|
|
, useProfiles ? true
|
2017-01-29 21:29:39 +00:00
|
|
|
, preferGtk2 ? false
|
2018-03-27 14:40:33 +01:00
|
|
|
, settings32Bit ? false
|
2017-05-31 14:52:03 +01:00
|
|
|
|
|
|
|
, prePatch ? ""
|
|
|
|
, patches ? []
|
2018-12-02 10:45:13 +00:00
|
|
|
, broken ? false
|
2017-01-29 21:29:39 +00:00
|
|
|
}:
|
|
|
|
|
2018-07-21 01:44:44 +01:00
|
|
|
{ stdenv, callPackage, pkgsi686Linux, fetchurl
|
2017-12-29 21:34:54 +00:00
|
|
|
, kernel ? null, xorg, zlib, perl, nukeReferences
|
2017-01-29 21:29:39 +00: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;
|
|
|
|
|
2018-08-11 16:32:00 +01:00
|
|
|
assert !libsOnly -> kernel != null;
|
|
|
|
assert versionOlder version "391" -> sha256_32bit != null;
|
|
|
|
assert ! versionOlder version "391" -> stdenv.hostPlatform.system == "x86_64-linux";
|
2017-01-29 21:29:39 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
nameSuffix = optionalString (!libsOnly) "-${kernel.version}";
|
|
|
|
pkgSuffix = optionalString (versionOlder version "304") "-pkg0";
|
2018-08-11 16:32:00 +01:00
|
|
|
i686bundled = versionAtLeast version "391";
|
|
|
|
|
2017-01-29 21:29:39 +00:00
|
|
|
|
|
|
|
self = stdenv.mkDerivation {
|
|
|
|
name = "nvidia-x11-${version}${nameSuffix}";
|
|
|
|
|
|
|
|
builder = ./builder.sh;
|
|
|
|
|
|
|
|
src =
|
2018-08-11 16:32:00 +01:00
|
|
|
if stdenv.hostPlatform.system == "x86_64-linux" then
|
2017-01-29 21:29:39 +00:00
|
|
|
fetchurl {
|
2017-04-29 22:19:04 +01:00
|
|
|
url = "https://download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}${pkgSuffix}.run";
|
2017-01-29 21:29:39 +00:00
|
|
|
sha256 = sha256_64bit;
|
|
|
|
}
|
2018-08-11 16:32:00 +01:00
|
|
|
else if stdenv.hostPlatform.system == "i686-linux" then
|
|
|
|
fetchurl {
|
|
|
|
url = "https://download.nvidia.com/XFree86/Linux-x86/${version}/NVIDIA-Linux-x86-${version}${pkgSuffix}.run";
|
|
|
|
sha256 = sha256_32bit;
|
|
|
|
}
|
2018-08-20 20:11:29 +01:00
|
|
|
else throw "nvidia-x11 does not support platform ${stdenv.hostPlatform.system}";
|
2017-01-29 21:29:39 +00:00
|
|
|
|
2017-05-31 14:52:03 +01:00
|
|
|
patches = if libsOnly then null else patches;
|
|
|
|
inherit prePatch;
|
2017-02-11 14:11:18 +00:00
|
|
|
inherit version useGLVND useProfiles;
|
2018-08-20 20:11:29 +01:00
|
|
|
inherit (stdenv.hostPlatform) system;
|
2018-08-11 16:32:00 +01:00
|
|
|
inherit i686bundled;
|
2017-01-29 21:29:39 +00:00
|
|
|
|
2018-08-11 16:32:00 +01:00
|
|
|
outputs = [ "out" ]
|
|
|
|
++ optional i686bundled "lib32"
|
|
|
|
++ optional (!libsOnly) "bin";
|
2017-01-29 21:29:39 +00:00
|
|
|
outputDev = if libsOnly then null else "bin";
|
|
|
|
|
|
|
|
kernel = if libsOnly then null else kernel.dev;
|
2018-06-24 09:49:08 +01:00
|
|
|
kernelVersion = if libsOnly then null else kernel.modDirVersion;
|
2017-01-29 21:29:39 +00:00
|
|
|
|
|
|
|
hardeningDisable = [ "pic" "format" ];
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
dontPatchELF = true;
|
|
|
|
|
2018-09-12 01:13:14 +01:00
|
|
|
libPath = makeLibraryPath [ xorg.libXext xorg.libX11 xorg.libXv xorg.libXrandr xorg.libxcb zlib stdenv.cc.cc ];
|
2017-01-29 21:29:39 +00:00
|
|
|
|
2017-12-30 16:44:45 +00:00
|
|
|
nativeBuildInputs = [ perl nukeReferences ]
|
|
|
|
++ optionals (!libsOnly) kernel.moduleBuildDependencies;
|
2017-12-28 12:16:26 +00:00
|
|
|
|
2017-01-29 21:29:39 +00:00
|
|
|
disallowedReferences = optional (!libsOnly) [ kernel.dev ];
|
|
|
|
|
|
|
|
passthru = {
|
2018-07-05 19:04:52 +01:00
|
|
|
settings = (if settings32Bit then pkgsi686Linux.callPackage else callPackage) (import ./settings.nix self settingsSha256) {
|
2017-01-29 21:29:39 +00:00
|
|
|
withGtk2 = preferGtk2;
|
|
|
|
withGtk3 = !preferGtk2;
|
|
|
|
};
|
2017-04-17 21:48:10 +01:00
|
|
|
persistenced = mapNullable (hash: callPackage (import ./persistenced.nix self hash) { }) persistencedSha256;
|
2017-01-29 21:29:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = http://www.nvidia.com/object/unix.html;
|
|
|
|
description = "X.org driver and kernel module for NVIDIA graphics cards";
|
|
|
|
license = licenses.unfreeRedistributable;
|
2018-03-27 14:40:15 +01:00
|
|
|
platforms = [ "i686-linux" "x86_64-linux" ];
|
2019-01-10 11:13:28 +00:00
|
|
|
maintainers = with maintainers; [ baracoder ];
|
2017-01-29 21:29:39 +00:00
|
|
|
priority = 4; # resolves collision with xorg-server's "lib/xorg/modules/extensions/libglx.so"
|
2018-12-02 10:45:13 +00:00
|
|
|
inherit broken;
|
2017-01-29 21:29:39 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in self
|