summary refs log tree commit diff
path: root/pkgs/os-specific/linux/nvidia-x11
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2017-05-31 16:52:03 +0300
committerNikolay Amiantov <ab@fmap.me>2017-05-31 16:52:03 +0300
commit7b41780a0e4defe29e2bf9a17511b521db01c67d (patch)
tree091bd53bc20cae1fcf8541dd4d35d34a44ea6fbc /pkgs/os-specific/linux/nvidia-x11
parent3b4ef34fa0e8963db3df4ae58271d1298a5d87a9 (diff)
downloadnixlib-7b41780a0e4defe29e2bf9a17511b521db01c67d.tar
nixlib-7b41780a0e4defe29e2bf9a17511b521db01c67d.tar.gz
nixlib-7b41780a0e4defe29e2bf9a17511b521db01c67d.tar.bz2
nixlib-7b41780a0e4defe29e2bf9a17511b521db01c67d.tar.lz
nixlib-7b41780a0e4defe29e2bf9a17511b521db01c67d.tar.xz
nixlib-7b41780a0e4defe29e2bf9a17511b521db01c67d.tar.zst
nixlib-7b41780a0e4defe29e2bf9a17511b521db01c67d.zip
linuxPackages.nvidia_x11: move patches to specific versions
Diffstat (limited to 'pkgs/os-specific/linux/nvidia-x11')
-rw-r--r--pkgs/os-specific/linux/nvidia-x11/default.nix28
-rw-r--r--pkgs/os-specific/linux/nvidia-x11/generic.nix42
2 files changed, 32 insertions, 38 deletions
diff --git a/pkgs/os-specific/linux/nvidia-x11/default.nix b/pkgs/os-specific/linux/nvidia-x11/default.nix
index 3157273c5d3a..307c661ddf43 100644
--- a/pkgs/os-specific/linux/nvidia-x11/default.nix
+++ b/pkgs/os-specific/linux/nvidia-x11/default.nix
@@ -1,4 +1,4 @@
-{ callPackage }:
+{ lib, callPackage, fetchurl, fetchpatch }:
 
 let
   generic = args: callPackage (import ./generic.nix args) { };
@@ -28,6 +28,17 @@ in
     settingsSha256 = "0nm5c06b09p6wsxpyfaqrzsnal3p1047lk6p4p2a0vksb7id9598";
     persistencedSha256 = "1jwmggbph9zd8fj4syihldp2a5bxff7q1i2l9c55xz8cvk0rx08i";
     useGLVND = false;
+
+    patches = [
+      (fetchpatch {
+        name = "kernel-4.10.patch";
+        url = https://git.archlinux.org/svntogit/packages.git/plain/nvidia-340xx/trunk/4.10.0_kernel.patch?id=53fb1df89;
+        sha256 = "171hb57m968qdjcr3h8ppfzhrchf573f39rdja86a1qq1gmrv7pa";
+      })
+      # from https://git.archlinux.org/svntogit/packages.git/plain/trunk/fs52243.patch?h=packages/nvidia-340xx
+      # with datestamps removed
+      ./fs52243.patch
+    ];
   };
 
   legacy_304 = generic {
@@ -38,6 +49,21 @@ in
     persistencedSha256 = null;
     useGLVND = false;
     useProfiles = false;
+
+    prePatch = let
+      debPatches = fetchurl {
+        url = "mirror://debian/pool/non-free/n/nvidia-graphics-drivers-legacy-304xx/"
+            + "nvidia-graphics-drivers-legacy-304xx_304.135-2.debian.tar.xz";
+        sha256 = "0mhji0ssn7075q5a650idigs48kzf11pzj2ca2n07rwxg3vj6pdr";
+      };
+      prefix = "debian/module/debian/patches";
+      applyPatches = pnames: if pnames == [] then null else
+        ''
+          tar xf '${debPatches}'
+          sed 's|^\([+-]\{3\} [ab]\)/|\1/kernel/|' -i ${prefix}/*.patch
+          patches="$patches ${lib.concatMapStringsSep " " (pname: "${prefix}/${pname}.patch") pnames}"
+        '';
+    in applyPatches [ "fix-typos" "drm-driver-legacy" "deprecated-cpu-events" "disable-mtrr" ];
   };
 
   legacy_173 = callPackage ./legacy173.nix { };
diff --git a/pkgs/os-specific/linux/nvidia-x11/generic.nix b/pkgs/os-specific/linux/nvidia-x11/generic.nix
index 4c983227d6a5..0d19079fe662 100644
--- a/pkgs/os-specific/linux/nvidia-x11/generic.nix
+++ b/pkgs/os-specific/linux/nvidia-x11/generic.nix
@@ -6,6 +6,9 @@
 , useGLVND ? true
 , useProfiles ? true
 , preferGtk2 ? false
+
+, prePatch ? ""
+, patches ? []
 }:
 
 { stdenv, callPackage, callPackage_i686, fetchurl, fetchpatch
@@ -42,43 +45,8 @@ let
         }
       else throw "nvidia-x11 does not support platform ${stdenv.system}";
 
-    prePatch = let
-      debPatches = fetchurl {
-        url = "mirror://debian/pool/non-free/n/nvidia-graphics-drivers-legacy-304xx/"
-            + "nvidia-graphics-drivers-legacy-304xx_304.135-2.debian.tar.xz";
-        sha256 = "0mhji0ssn7075q5a650idigs48kzf11pzj2ca2n07rwxg3vj6pdr";
-      };
-      prefix = "debian/module/debian/patches";
-      applyPatches = pnames: if pnames == [] then null else
-        ''
-          tar xf '${debPatches}'
-          sed 's|^\([+-]\{3\} [ab]\)/|\1/kernel/|' -i ${prefix}/*.patch
-          patches="$patches ${concatMapStringsSep " " (pname: "${prefix}/${pname}.patch") pnames}"
-        '';
-    in
-      # TODO: perhaps other branches also need patching?
-      if (versionOlder version "340") then applyPatches
-        [ "fix-typos" "drm-driver-legacy" "deprecated-cpu-events" "disable-mtrr" ]
-      else null;
-
-    # patch to get the nvidia and nvidiaBeta driver to compile on kernel 4.10
-    patches = if libsOnly
-              then null
-              else if versionOlder version "340"
-              then null
-              else if versionOlder version "375"
-              then [
-                     (fetchpatch {
-                        name = "kernel-4.10.patch";
-                        url = https://git.archlinux.org/svntogit/packages.git/plain/nvidia-340xx/trunk/4.10.0_kernel.patch?id=53fb1df89;
-                        sha256 = "171hb57m968qdjcr3h8ppfzhrchf573f39rdja86a1qq1gmrv7pa";
-                     })
-                         # from https://git.archlinux.org/svntogit/packages.git/plain/trunk/fs52243.patch?h=packages/nvidia-340xx
-                         # with datestamps removed
-                     ./fs52243.patch
-                   ]
-              else null;
-
+    patches = if libsOnly then null else patches;
+    inherit prePatch;
     inherit version useGLVND useProfiles;
     inherit (stdenv) system;