summary refs log tree commit diff
path: root/pkgs/os-specific/linux/nvidia-x11/generic.nix
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2017-05-31 10:45:44 +0200
committerVladimír Čunát <vcunat@gmail.com>2017-05-31 10:48:54 +0200
commit0c4b91505ed6f5ec6475468cb07c3ef8018eed34 (patch)
tree523c5163c39864eff951cfdff1e4292691437c86 /pkgs/os-specific/linux/nvidia-x11/generic.nix
parentaf58f8de55d836ddd266bc99be10251ae3703c99 (diff)
downloadnixpkgs-0c4b91505ed6f5ec6475468cb07c3ef8018eed34.tar
nixpkgs-0c4b91505ed6f5ec6475468cb07c3ef8018eed34.tar.gz
nixpkgs-0c4b91505ed6f5ec6475468cb07c3ef8018eed34.tar.bz2
nixpkgs-0c4b91505ed6f5ec6475468cb07c3ef8018eed34.tar.lz
nixpkgs-0c4b91505ed6f5ec6475468cb07c3ef8018eed34.tar.xz
nixpkgs-0c4b91505ed6f5ec6475468cb07c3ef8018eed34.tar.zst
nixpkgs-0c4b91505ed6f5ec6475468cb07c3ef8018eed34.zip
nvidia_x11_legacy304: apply patches from Debian
The drivers would build but probably wouldn't work without them.
See #26250.
Diffstat (limited to 'pkgs/os-specific/linux/nvidia-x11/generic.nix')
-rw-r--r--pkgs/os-specific/linux/nvidia-x11/generic.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/nvidia-x11/generic.nix b/pkgs/os-specific/linux/nvidia-x11/generic.nix
index a21e6ecfc31..4c983227d6a 100644
--- a/pkgs/os-specific/linux/nvidia-x11/generic.nix
+++ b/pkgs/os-specific/linux/nvidia-x11/generic.nix
@@ -42,6 +42,25 @@ 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