git.iko.soy/typeable/nixpkgs
on master help sign in
linuxPackages.nvidia_x11: move patches to specific versions
commit7b41780a0e4defe29e2bf9a17511b521db01c67d authorNikolay Amiantov <ab@fmap.me> dateWed 31 May 2017, 16:52 (10 years ago) parent3b4ef34
2 files changed+32−38
pkgs/os-specific/linux/nvidia-x11/default.nix+27−1 pkgs/os-specific/linux/nvidia-x11/generic.nix+5−37
pkgs/os-specific/linux/nvidia-x11/default.nix+27−1
@@ -1,4 +1,4 @@
1−{ callPackage }:
1+{ lib, callPackage, fetchurl, fetchpatch }:
22
33let
44 generic = args: callPackage (import ./generic.nix args) { };
@@ -28,6 +28,17 @@ in
2828 settingsSha256 = "0nm5c06b09p6wsxpyfaqrzsnal3p1047lk6p4p2a0vksb7id9598";
2929 persistencedSha256 = "1jwmggbph9zd8fj4syihldp2a5bxff7q1i2l9c55xz8cvk0rx08i";
3030 useGLVND = false;
31+
32+ patches = [
33+ (fetchpatch {
34+ name = "kernel-4.10.patch";
35+ url = https://git.archlinux.org/svntogit/packages.git/plain/nvidia-340xx/trunk/4.10.0_kernel.patch?id=53fb1df89;
36+ sha256 = "171hb57m968qdjcr3h8ppfzhrchf573f39rdja86a1qq1gmrv7pa";
37+ })
38+ # from https://git.archlinux.org/svntogit/packages.git/plain/trunk/fs52243.patch?h=packages/nvidia-340xx
39+ # with datestamps removed
40+ ./fs52243.patch
41+ ];
3142 };
3243
3344 legacy_304 = generic {
@@ -38,6 +49,21 @@ in
3849 persistencedSha256 = null;
3950 useGLVND = false;
4051 useProfiles = false;
52+
53+ prePatch = let
54+ debPatches = fetchurl {
55+ url = "mirror://debian/pool/non-free/n/nvidia-graphics-drivers-legacy-304xx/"
56+ + "nvidia-graphics-drivers-legacy-304xx_304.135-2.debian.tar.xz";
57+ sha256 = "0mhji0ssn7075q5a650idigs48kzf11pzj2ca2n07rwxg3vj6pdr";
58+ };
59+ prefix = "debian/module/debian/patches";
60+ applyPatches = pnames: if pnames == [] then null else
61+ ''
62+ tar xf '${debPatches}'
63+ sed 's|^\([+-]\{3\} [ab]\)/|\1/kernel/|' -i ${prefix}/*.patch
64+ patches="$patches ${lib.concatMapStringsSep " " (pname: "${prefix}/${pname}.patch") pnames}"
65+ '';
66+ in applyPatches [ "fix-typos" "drm-driver-legacy" "deprecated-cpu-events" "disable-mtrr" ];
4167 };
4268
4369 legacy_173 = callPackage ./legacy173.nix { };
pkgs/os-specific/linux/nvidia-x11/generic.nix+5−37
@@ -6,6 +6,9 @@
66, useGLVND ? true
77, useProfiles ? true
88, preferGtk2 ? false
9+
10+, prePatch ? ""
11+, patches ? []
912}:
1013
1114{ stdenv, callPackage, callPackage_i686, fetchurl, fetchpatch
@@ -42,43 +45,8 @@ let
4245 }
4346 else throw "nvidia-x11 does not support platform ${stdenv.system}";
4447
45− prePatch = let
46− debPatches = fetchurl {
47− url = "mirror://debian/pool/non-free/n/nvidia-graphics-drivers-legacy-304xx/"
48− + "nvidia-graphics-drivers-legacy-304xx_304.135-2.debian.tar.xz";
49− sha256 = "0mhji0ssn7075q5a650idigs48kzf11pzj2ca2n07rwxg3vj6pdr";
50− };
51− prefix = "debian/module/debian/patches";
52− applyPatches = pnames: if pnames == [] then null else
53− ''
54− tar xf '${debPatches}'
55− sed 's|^\([+-]\{3\} [ab]\)/|\1/kernel/|' -i ${prefix}/*.patch
56− patches="$patches ${concatMapStringsSep " " (pname: "${prefix}/${pname}.patch") pnames}"
57− '';
58− in
59− # TODO: perhaps other branches also need patching?
60− if (versionOlder version "340") then applyPatches
61− [ "fix-typos" "drm-driver-legacy" "deprecated-cpu-events" "disable-mtrr" ]
62− else null;
63−
64− # patch to get the nvidia and nvidiaBeta driver to compile on kernel 4.10
65− patches = if libsOnly
66− then null
67− else if versionOlder version "340"
68− then null
69− else if versionOlder version "375"
70− then [
71− (fetchpatch {
72− name = "kernel-4.10.patch";
73− url = https://git.archlinux.org/svntogit/packages.git/plain/nvidia-340xx/trunk/4.10.0_kernel.patch?id=53fb1df89;
74− sha256 = "171hb57m968qdjcr3h8ppfzhrchf573f39rdja86a1qq1gmrv7pa";
75− })
76− # from https://git.archlinux.org/svntogit/packages.git/plain/trunk/fs52243.patch?h=packages/nvidia-340xx
77− # with datestamps removed
78− ./fs52243.patch
79− ]
80− else null;
81−
48+ patches = if libsOnly then null else patches;
49+ inherit prePatch;
8250 inherit version useGLVND useProfiles;
8351 inherit (stdenv) system;
8452