From f8b091d53fdb339a9489551e21ceb4bad84c79e9 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Sat, 30 Mar 2024 19:17:57 +1300 Subject: [PATCH] stdenv/check-meta: Don't create new environments when computing meta.repository --- pkgs/stdenv/generic/check-meta.nix | 31 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index eb4482be7894..b5a40ca12b96 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -10,7 +10,9 @@ let concatMapStrings concatMapStringsSep concatStrings + filter findFirst + head isDerivation length concatMap @@ -436,6 +438,18 @@ let # ----- else { valid = "yes"; }); + getRepository = let + getSrcs = attrs: + if attrs ? src + then + [ attrs.src ] + else + filter (src: src ? meta.homepage) attrs.srcs; + getHomePages = map (src: src.meta.homepage); + unlist = list: + if length list == 1 then head list + else list; + in attrs: unlist (getHomePages (getSrcs attrs)); # The meta attribute is passed in the resulting attribute set, # but it's not part of the actual derivation, i.e., it's not @@ -454,22 +468,7 @@ let # this could be handled a lot easier if we nulled it instead # of having it be undefined, but that wouldn't match the # other attributes. - repository = let - getSrcs = attrs: - if attrs ? src - then - [ attrs.src ] - else - lib.filter (src: src ? meta.homepage) attrs.srcs; - getHomePages = srcs: map (src: src.meta.homepage) srcs; - unlist = list: - if lib.length list == 1 - then - lib.elemAt list 0 - else - list; - in - unlist (getHomePages (getSrcs attrs)); + repository = getRepository attrs; } // { # `name` derivation attribute includes cross-compilation cruft, # is under assert, and is sanitized.