From 2a6f660292e2b8fcc07c6856738db03178a9e317 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 1 Dec 2024 11:05:58 +0100 Subject: [PATCH] stdenv.mkDerivation: improve performance of outputChecks As discussed in https://github.com/NixOS/nixpkgs/pull/357054#discussion_r1864675075. --- pkgs/stdenv/generic/make-derivation.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 33dc7c294e2fe..c9b6143a14010 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -37,6 +37,7 @@ let splitString subtractLists unique + zipAttrsWith ; inherit (import ../../build-support/lib/cmake.nix { inherit lib stdenv; }) makeCMakeFlags; @@ -493,17 +494,15 @@ else let "/bin/sh" ]; __propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps; - }) // lib.optionalAttrs (!__structuredAttrs) ( - makeOutputChecks attrs - ) // lib.optionalAttrs (__structuredAttrs) { + }) // (if !__structuredAttrs then makeOutputChecks attrs else { outputChecks = builtins.listToAttrs (map (name: { inherit name; - value = lib.zipAttrsWith (_: builtins.concatLists) [ + value = zipAttrsWith (_: builtins.concatLists) [ (makeOutputChecks attrs) (makeOutputChecks attrs.outputChecks.${name} or {}) ]; }) outputs); - }; + }); in derivationArg;