From 6aa4ed448704ab8acd5a57a607e3489710aa358a Mon Sep 17 00:00:00 2001 From: Thomas Lepoix Date: Thu, 29 Feb 2024 01:29:48 +0100 Subject: [PATCH] applyPatches: Fix a bug (#283887) --- pkgs/build-support/trivial-builders/default.nix | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkgs/build-support/trivial-builders/default.nix b/pkgs/build-support/trivial-builders/default.nix index a38231bdcaa3..cecf3f5eae84 100644 --- a/pkgs/build-support/trivial-builders/default.nix +++ b/pkgs/build-support/trivial-builders/default.nix @@ -904,22 +904,23 @@ rec { else throw "applyPatches: please supply a `name` argument because a default name can only be computed when the `src` is a path or is an attribute set with a `name` attribute." ) + "-patched" , patches ? [ ] + , prePatch ? "" , postPatch ? "" , ... }@args: - if patches == [ ] && postPatch == "" + if patches == [ ] && prePatch == "" && postPatch == "" then src # nothing to do, so use original src to avoid additional drv else stdenvNoCC.mkDerivation - { - inherit name src patches postPatch; + ({ + inherit name src patches prePatch postPatch; preferLocalBuild = true; allowSubstitutes = false; phases = "unpackPhase patchPhase installPhase"; installPhase = "cp -R ./ $out"; } - # Carry `meta` information from the underlying `src` if present. - // (optionalAttrs (src?meta) { inherit (src) meta; }) - // (removeAttrs args [ "src" "name" "patches" "postPatch" ]); + # Carry `meta` information from the underlying `src` if present. + // (optionalAttrs (src?meta) { inherit (src) meta; }) + // (removeAttrs args [ "src" "name" "patches" "prePatch" "postPatch" ])); /* An immutable file in the store with a length of 0 bytes. */ emptyFile = runCommand "empty-file"