meta: Simplify platform check logic
Code golf or readability, you decide
This commit is contained in:
parent
26e8d58cb5
commit
f8ed783f4f
@ -174,9 +174,10 @@ 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:
|
||||
(!(attrs ? meta.platforms) || lib.any (lib.meta.platformMatch hostPlatform) attrs.meta.platforms) &&
|
||||
(!(attrs ? meta.badPlatforms && lib.any (lib.meta.platformMatch hostPlatform) attrs.meta.badPlatforms));
|
||||
checkPlatform = attrs: let
|
||||
anyMatch = lib.any (lib.meta.platformMatch hostPlatform);
|
||||
in anyMatch (attrs.meta.platforms or lib.platforms.all) &&
|
||||
! anyMatch (attrs.meta.badPlatforms or []);
|
||||
|
||||
# Check if a derivation is valid, that is whether it passes checks for
|
||||
# e.g brokenness or license.
|
||||
|
Loading…
Reference in New Issue
Block a user