tvl-depot/nix/utils/default.nix
sterni 5d8490d2fc feat(users/Profpatsch): build attrset members on CI
Setting meta.targets to include all derivations in the different package
sets in Profpatsch's user folder makes them checked by CI until they do
the readTree refactor as promised.

To reduce code duplication we handle this in a simple function which is
exposed from nix.utils which may be a good place for depot specific bits
and bops we accumulate over time.

To get around the issue of too nested sets we perform the following
renames:

* users.Profpatsch.tests gets moved into its own directory
* users.Profpatsch.arglib.netencode now lives in its own file instead of
  the default.nix
* users.Profpatsch.netstring.tests gets moved into its own directory

Change-Id: Icd039c29d7760a711c1c53554504d6b0cd19e120
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2603
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
2021-03-15 22:16:19 +00:00

24 lines
462 B
Nix

{ depot, lib, ... }:
let
/* Takes an attribute set and adds a meta.targets
attribute to it which contains all direct children
of the attribute set which are derivations.
Type: attrs -> attrs
*/
drvTargets = attrs:
attrs // {
meta = {
targets = builtins.filter
(x: lib.isDerivation attrs."${x}")
(builtins.attrNames attrs);
} // (attrs.meta or {});
};
in {
inherit
drvTargets
;
}