summary refs log tree commit diff
path: root/pkgs/os-specific/linux/nvidia-x11/generic.nix
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2017-01-30 00:29:39 +0300
committerNikolay Amiantov <ab@fmap.me>2017-02-08 16:57:46 +0300
commit2fd2fcf54d6453a70564bfbf1c8d4fdfb5f9f079 (patch)
tree6de8a1be9ead1d441b9cd1a6b84aa75065d9935d /pkgs/os-specific/linux/nvidia-x11/generic.nix
parent750e7ba0d958a08cdef16a2147263586a55a3e4d (diff)
downloadnixpkgs-2fd2fcf54d6453a70564bfbf1c8d4fdfb5f9f079.tar
nixpkgs-2fd2fcf54d6453a70564bfbf1c8d4fdfb5f9f079.tar.gz
nixpkgs-2fd2fcf54d6453a70564bfbf1c8d4fdfb5f9f079.tar.bz2
nixpkgs-2fd2fcf54d6453a70564bfbf1c8d4fdfb5f9f079.tar.lz
nixpkgs-2fd2fcf54d6453a70564bfbf1c8d4fdfb5f9f079.tar.xz
nixpkgs-2fd2fcf54d6453a70564bfbf1c8d4fdfb5f9f079.tar.zst
nixpkgs-2fd2fcf54d6453a70564bfbf1c8d4fdfb5f9f079.zip
linuxPackages.nvidia_x11: refactor, build more from source
* Use libglvnd;
* Compile nvidia-settings, nvidia-persistenced from source;
* Generalize builder.
Diffstat (limited to 'pkgs/os-specific/linux/nvidia-x11/generic.nix')
-rw-r--r--pkgs/os-specific/linux/nvidia-x11/generic.nix81
1 files changed, 81 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/nvidia-x11/generic.nix b/pkgs/os-specific/linux/nvidia-x11/generic.nix
new file mode 100644
index 00000000000..1398dae0e64
--- /dev/null
+++ b/pkgs/os-specific/linux/nvidia-x11/generic.nix
@@ -0,0 +1,81 @@
+{ version
+, sha256_32bit
+, sha256_64bit
+, settingsSha256
+, persistencedSha256
+, useGLVND ? true
+, preferGtk2 ? false
+}:
+
+{ stdenv, callPackage, callPackage_i686, buildEnv, fetchurl
+, kernel ? null, xorg, zlib, perl, nukeReferences
+, # 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
+  nameSuffix = optionalString (!libsOnly) "-${kernel.version}";
+  pkgSuffix = optionalString (versionOlder version "304") "-pkg0";
+
+  self = stdenv.mkDerivation {
+    name = "nvidia-x11-${version}${nameSuffix}";
+
+    builder = ./builder.sh;
+
+    src =
+      if stdenv.system == "i686-linux" then
+        fetchurl {
+          url = "http://download.nvidia.com/XFree86/Linux-x86/${version}/NVIDIA-Linux-x86-${version}${pkgSuffix}.run";
+          sha256 = sha256_32bit;
+        }
+      else if stdenv.system == "x86_64-linux" then
+        fetchurl {
+          url = "http://download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}${pkgSuffix}.run";
+          sha256 = sha256_64bit;
+        }
+      else throw "nvidia-x11 does not support platform ${stdenv.system}";
+
+    inherit version useGLVND;
+    inherit (stdenv) system;
+
+    outputs = [ "out" ] ++ optional (!libsOnly) "bin";
+    outputDev = if libsOnly then null else "bin";
+
+    kernel = if libsOnly then null else kernel.dev;
+
+    hardeningDisable = [ "pic" "format" ];
+
+    dontStrip = true;
+    dontPatchELF = true;
+
+    libPath = makeLibraryPath [ xorg.libXext xorg.libX11 xorg.libXv xorg.libXrandr zlib stdenv.cc.cc ];
+
+    nativeBuildInputs = [ perl nukeReferences ];
+
+    disallowedReferences = optional (!libsOnly) [ kernel.dev ];
+
+    passthru = {
+      settings = callPackage (import ./settings.nix self settingsSha256) {
+        withGtk2 = preferGtk2;
+        withGtk3 = !preferGtk2;
+      };
+      persistenced = if persistencedSha256 == null then null else callPackage (import ./persistenced.nix self persistencedSha256) { };
+    };
+
+    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;
+      platforms = platforms.linux;
+      maintainers = [ maintainers.vcunat ];
+      priority = 4; # resolves collision with xorg-server's "lib/xorg/modules/extensions/libglx.so"
+    };
+  };
+
+in self