From 52c27352ce96097741420918d5f19573b29d168f Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Thu, 1 Jun 2023 13:48:58 -0400 Subject: [PATCH] applyPatches: skip creating additional drv when no patches If there are no `patches` or `postPatch`, then this will just do work to make something equivalent to `src`. Instead, just return `src` in that case. --- pkgs/build-support/trivial-builders/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/trivial-builders/default.nix b/pkgs/build-support/trivial-builders/default.nix index bdb79d9bf463c..07447b6461bc2 100644 --- a/pkgs/build-support/trivial-builders/default.nix +++ b/pkgs/build-support/trivial-builders/default.nix @@ -946,7 +946,10 @@ rec { , patches ? [ ] , postPatch ? "" , ... - }@args: stdenvNoCC.mkDerivation + }@args: + if patches == [ ] && postPatch == "" + then src # nothing to do, so use original src to avoid additional drv + else stdenvNoCC.mkDerivation { inherit name src patches postPatch; preferLocalBuild = true;