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