diff --git a/pkgs/build-support/fetchpatch/default.nix b/pkgs/build-support/fetchpatch/default.nix index a3ca6685147d..97b3661bb2d4 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" ]) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c179840d4b93..281ae8a6a201 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1073,14 +1073,14 @@ with pkgs; fetchpatch = callPackage ../build-support/fetchpatch { # 0.3.4 would change hashes: https://github.com/NixOS/nixpkgs/issues/25154 - patchutils = buildPackages.patchutils_0_3_3; + patchutils = __splicedPackages.patchutils_0_3_3; } // { tests = pkgs.tests.fetchpatch; version = 1; }; fetchpatch2 = callPackage ../build-support/fetchpatch { - patchutils = buildPackages.patchutils_0_4_2; + patchutils = __splicedPackages.patchutils_0_4_2; } // { tests = pkgs.tests.fetchpatch2; version = 2;