2021-05-11 21:05:05 +02:00
|
|
|
{ allSystems }:
|
2021-04-12 10:52:05 +02:00
|
|
|
system: packages:
|
|
|
|
let
|
|
|
|
# Adopted from nixpkgs.lib
|
2021-04-25 12:08:52 +02:00
|
|
|
inherit (builtins) listToAttrs concatMap attrNames;
|
2021-04-12 10:52:05 +02:00
|
|
|
nameValuePair = name: value: { inherit name value; };
|
|
|
|
filterAttrs = pred: set:
|
|
|
|
listToAttrs (
|
2021-06-14 10:47:39 +02:00
|
|
|
concatMap
|
|
|
|
(name:
|
|
|
|
let v = set.${name}; in
|
|
|
|
if pred name v then [ (nameValuePair name v) ] else [ ]
|
|
|
|
)
|
|
|
|
(attrNames set)
|
2021-04-12 10:52:05 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
# Everything that nix flake check requires for the packages output
|
|
|
|
sieve = n: v:
|
|
|
|
with v;
|
|
|
|
let
|
|
|
|
inherit (builtins) isAttrs;
|
|
|
|
isDerivation = x: isAttrs x && x ? type && x.type == "derivation";
|
2021-05-11 21:05:05 +02:00
|
|
|
isBroken = meta.broken or false;
|
|
|
|
platforms = meta.hydraPlatforms or meta.platforms or allSystems;
|
2021-04-12 10:52:05 +02:00
|
|
|
in
|
2021-06-14 10:47:39 +02:00
|
|
|
# check for isDerivation, so this is independently useful of
|
2021-04-12 10:52:05 +02:00
|
|
|
# flattenTree, which also does filter on derviations
|
2021-06-14 10:47:39 +02:00
|
|
|
isDerivation v && !isBroken && builtins.elem system platforms
|
2021-04-12 10:52:05 +02:00
|
|
|
;
|
|
|
|
in
|
|
|
|
filterAttrs sieve packages
|