@@ -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