diff --git a/pkgs/build-support/fetchpatch/default.nix b/pkgs/build-support/fetchpatch/default.nix index 0e7be1717107..9f384e732846 100644 --- a/pkgs/build-support/fetchpatch/default.nix +++ b/pkgs/build-support/fetchpatch/default.nix @@ -17,6 +17,7 @@ extraPrefix ? null, excludes ? [ ], includes ? [ ], + hunks ? [ ], revert ? false, postFetch ? "", nativeBuildInputs ? [ ], @@ -88,8 +89,12 @@ lib.throwIfNot (excludes == [ ] || includes == [ ]) filterdiff \ -p1 \ - ${builtins.toString (builtins.map (x: "-x ${lib.escapeShellArg x}") excludes)} \ - ${builtins.toString (builtins.map (x: "-i ${lib.escapeShellArg x}") includes)} \ + ${toString (map (x: "-x ${lib.escapeShellArg x}") excludes)} \ + ${toString (map (x: "-i ${lib.escapeShellArg x}") includes)} \ + ${ + lib.optionalString (hunks != [ ]) + "-# ${lib.escapeShellArg (lib.concatMapStringsSep "," toString hunks)}" + } \ "$tmpfile" > "$out" if [ ! -s "$out" ]; then @@ -113,6 +118,7 @@ lib.throwIfNot (excludes == [ ] || includes == [ ]) "extraPrefix" "excludes" "includes" + "hunks" "revert" "postFetch" "nativeBuildInputs"