···6767 */6868 hiPrioSet = set: mapDerivationAttrset hiPrio set;69697070+7171+ /* Check to see if a platform is matched by the given `meta.platforms`7272+ element.7373+7474+ A `meta.platform` pattern is either7575+7676+ 1. (legacy) a system string.7777+7878+ 2. (modern) a pattern for the platform `parsed` field.7979+8080+ We can inject these into a patten for the whole of a structured platform,8181+ and then match that.8282+ */8383+ platformMatch = platform: elem: let8484+ pattern =8585+ if builtins.isString elem8686+ then { system = elem; }8787+ else { parsed = elem; };8888+ in lib.matchAttrs pattern platform;7089}
+2-4
pkgs/stdenv/generic/check-meta.nix
···173173 else "key '${k}' is unrecognized; expected one of: \n\t [${lib.concatMapStringsSep ", " (x: "'${x}'") (lib.attrNames metaTypes)}]";174174 checkMeta = meta: if shouldCheckMeta then lib.remove null (lib.mapAttrsToList checkMetaAttr meta) else [];175175176176- checkPlatform = attrs: let177177- raw = attrs.meta.platforms;178178- uniform = map (x: if builtins.isString x then { system = x; } else { parsed = x; }) raw;179179- in lib.any (pat: lib.matchAttrs pat hostPlatform) uniform;176176+ checkPlatform = attrs:177177+ lib.any (lib.meta.platformMatch hostPlatform) attrs.meta.platforms;180178181179 # Check if a derivation is valid, that is whether it passes checks for182180 # e.g brokenness or license.
+5-11
pkgs/top-level/release-lib.nix
···9898 packagePlatforms = mapAttrs (name: value:9999 let res = builtins.tryEval (100100 if isDerivation value then101101- # TODO(@Ericson2314) deduplicate with `checkPlatform` in102102- # `pkgs/stdenv/generic/check-meta.nix`.103101 value.meta.hydraPlatforms or (let104104- raw = value.meta.platforms or [ "x86_64-linux" ];105105- toPattern = x: if builtins.isString x106106- then { system = x; }107107- else { parsed = x; };108108- uniform = map toPattern raw;109109- pred = hostPlatform:110110- lib.any (pat: lib.matchAttrs pat hostPlatform) uniform;111111- pred' = system: pred (lib.systems.elaborate { inherit system; });112112- in lib.filter pred' supportedSystems)102102+ linuxDefaulted = value.meta.platforms or [ "x86_64-linux" ];103103+ pred = system: lib.any104104+ (lib.meta.platformMatch (lib.systems.elaborate { inherit system; }))105105+ linuxDefaulted;106106+ in lib.filter pred supportedSystems)113107 else if value.recurseForDerivations or false || value.recurseForRelease or false then114108 packagePlatforms value115109 else