lib: Factor in tiny bit of meta.platform checking
I need it in stdenv and release-lib, so that seems motivation enough.
This commit is contained in:
@@ -173,10 +173,8 @@ let
|
||||
else "key '${k}' is unrecognized; expected one of: \n\t [${lib.concatMapStringsSep ", " (x: "'${x}'") (lib.attrNames metaTypes)}]";
|
||||
checkMeta = meta: if shouldCheckMeta then lib.remove null (lib.mapAttrsToList checkMetaAttr meta) else [];
|
||||
|
||||
checkPlatform = attrs: let
|
||||
raw = attrs.meta.platforms;
|
||||
uniform = map (x: if builtins.isString x then { system = x; } else { parsed = x; }) raw;
|
||||
in lib.any (pat: lib.matchAttrs pat hostPlatform) uniform;
|
||||
checkPlatform = attrs:
|
||||
lib.any (lib.meta.platformMatch hostPlatform) attrs.meta.platforms;
|
||||
|
||||
# Check if a derivation is valid, that is whether it passes checks for
|
||||
# e.g brokenness or license.
|
||||
|
||||
Reference in New Issue
Block a user