From dc49349c84cc05f9cb50c9f46e4330f053803d0b Mon Sep 17 00:00:00 2001 From: adisbladis Date: Sat, 30 Mar 2024 19:20:59 +1300 Subject: [PATCH] stdenv/check-meta: Inherit remaining lib access into scope Hopefully this will result in people not adding new `lib.xxx` to check-meta.nix. --- pkgs/stdenv/generic/check-meta.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index b5a40ca12b96..1653e9cf3193 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -31,6 +31,14 @@ let toList isList elem + ; + + inherit (lib.meta) + availableOn + ; + + inherit (lib.generators) + toPretty ; # If we're in hydra, we can dispense with the more verbose error @@ -86,7 +94,7 @@ let # was `licenses: lib.lists.any (l: !l.free or true) licenses;` # which always evaluates to `!true` for strings. else if isString licenses then false - else lib.lists.any (l: !l.free or true) licenses; + else any (l: !l.free or true) licenses; hasUnfreeLicense = attrs: hasLicense attrs && isUnfree attrs.meta.license; @@ -96,7 +104,7 @@ let isMarkedBroken = attrs: attrs.meta.broken or false; hasUnsupportedPlatform = - pkg: !(lib.meta.availableOn hostPlatform pkg); + pkg: !(availableOn hostPlatform pkg); isMarkedInsecure = attrs: (attrs.meta.knownVulnerabilities or []) != []; @@ -366,7 +374,7 @@ let [ ] else [ "key 'meta.${k}' has invalid value; expected ${metaTypes.${k}.name}, got\n ${ - lib.generators.toPretty { indent = " "; } v + toPretty { indent = " "; } v }" ] else [ "key 'meta.${k}' is unrecognized; expected one of: \n [${concatMapStringsSep ", " (x: "'${x}'") (attrNames metaTypes)}]" ]; @@ -416,7 +424,7 @@ let else if !allowBroken && attrs.meta.broken or false then { valid = "no"; reason = "broken"; errormsg = "is marked as broken"; } else if !allowUnsupportedSystem && hasUnsupportedPlatform attrs then - let toPretty = lib.generators.toPretty { + let toPretty = toPretty { allowPrettyValues = true; indent = " "; };