diff options
-rw-r--r-- | pkgs/build-support/fetchpatch/default.nix | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pkgs/build-support/fetchpatch/default.nix b/pkgs/build-support/fetchpatch/default.nix index 60785f42b543..a6ddf132cd5b 100644 --- a/pkgs/build-support/fetchpatch/default.nix +++ b/pkgs/build-support/fetchpatch/default.nix @@ -4,8 +4,8 @@ # often change with updating of git or cgit. # stripLen acts as the -p parameter when applying a patch. -{ fetchurl, patchutils }: -{ stripLen ? 0, ... }@args: +{ lib, fetchurl, patchutils }: +{ stripLen ? 0, addPrefixes ? false, ... }@args: fetchurl ({ postFetch = '' @@ -16,8 +16,12 @@ fetchurl ({ "${patchutils}/bin/filterdiff" \ --include={} \ --strip=${toString stripLen} \ + ${lib.optionalString addPrefixes '' + --addoldprefix=a/ \ + --addnewprefix=b/ \ + ''} \ --clean "$out" > "$tmpfile" mv "$tmpfile" "$out" ${args.postFetch or ""} ''; -} // builtins.removeAttrs args ["stripLen"]) +} // builtins.removeAttrs args ["stripLen" "addPrefixes"]) |