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)}]";
|
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 [];
|
checkMeta = meta: if shouldCheckMeta then lib.remove null (lib.mapAttrsToList checkMetaAttr meta) else [];
|
||||||
|
|
||||||
checkPlatform = attrs:
|
checkPlatform = attrs: let
|
||||||
(!(attrs ? meta.platforms) || lib.any (lib.meta.platformMatch hostPlatform) attrs.meta.platforms) &&
|
anyMatch = lib.any (lib.meta.platformMatch hostPlatform);
|
||||||
(!(attrs ? meta.badPlatforms && lib.any (lib.meta.platformMatch hostPlatform) attrs.meta.badPlatforms));
|
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
|
# Check if a derivation is valid, that is whether it passes checks for
|
||||||
# e.g brokenness or license.
|
# e.g brokenness or license.
|
||||||
|
Loading…
Reference in New Issue
Block a user