about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorIvan Trubach <mr.trubach@icloud.com>2024-07-01 17:01:44 +0300
committerIvan Trubach <mr.trubach@icloud.com>2024-07-01 18:09:00 +0300
commit6ed79156cef042b7dcfa206bafaa824d0a9ef638 (patch)
tree500af4488ccb2883164fff2ed4cdc613bd866d31 /pkgs/build-support
parent32b51c33521a297b4a7d9015f49fdf52db18e467 (diff)
fetchpatch: add patchutils to nativeBuildInputs
This change allows using programs from patchutils in postFetch.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/fetchpatch/default.nix12
1 files changed, 7 insertions, 5 deletions
diff --git a/pkgs/build-support/fetchpatch/default.nix b/pkgs/build-support/fetchpatch/default.nix
index a3ca6685147d3..97b3661bb2d46 100644
--- a/pkgs/build-support/fetchpatch/default.nix
+++ b/pkgs/build-support/fetchpatch/default.nix
@@ -14,6 +14,7 @@
 , includes ? []
 , revert ? false
 , postFetch ? ""
+, nativeBuildInputs ? []
 , ...
 }@args:
 let
@@ -29,6 +30,7 @@ in
 lib.throwIfNot (excludes == [] || includes == [])
   "fetchpatch: cannot use excludes and includes simultaneously"
 fetchurl ({
+  nativeBuildInputs = [ patchutils ] ++ nativeBuildInputs;
   postFetch = ''
     tmpfile="$TMPDIR/patch"
 
@@ -48,12 +50,12 @@ fetchurl ({
     set -e
     mv "$tmpfile" "$out"
 
-    "${patchutils}/bin/lsdiff" \
+    lsdiff \
       ${lib.optionalString (relative != null) "-p1 -i ${lib.escapeShellArg relative}/'*'"} \
       "$out" \
     | sort -u | sed -e 's/[*?]/\\&/g' \
     | xargs -I{} \
-      "${patchutils}/bin/filterdiff" \
+      filterdiff \
       --include={} \
       --strip=${toString stripLen} \
       ${lib.optionalString (extraPrefix != null) ''
@@ -70,7 +72,7 @@ fetchurl ({
       exit 1
     fi
 
-    ${patchutils}/bin/filterdiff \
+    filterdiff \
       -p1 \
       ${builtins.toString (builtins.map (x: "-x ${lib.escapeShellArg x}") excludes)} \
       ${builtins.toString (builtins.map (x: "-i ${lib.escapeShellArg x}") includes)} \
@@ -84,10 +86,10 @@ fetchurl ({
       exit 1
     fi
   '' + lib.optionalString revert ''
-    ${patchutils}/bin/interdiff "$out" /dev/null > "$tmpfile"
+    interdiff "$out" /dev/null > "$tmpfile"
     mv "$tmpfile" "$out"
   '' + postFetch;
 } // builtins.removeAttrs args [
   "relative" "stripLen" "decode" "extraPrefix" "excludes" "includes" "revert"
-  "postFetch"
+  "postFetch" "nativeBuildInputs"
 ])