diff options
Diffstat (limited to 'nix')
-rw-r--r-- | nix/utils/OWNERS | 3 | ||||
-rw-r--r-- | nix/utils/default.nix | 24 |
2 files changed, 27 insertions, 0 deletions
diff --git a/nix/utils/OWNERS b/nix/utils/OWNERS new file mode 100644 index 000000000000..f16dd105d761 --- /dev/null +++ b/nix/utils/OWNERS @@ -0,0 +1,3 @@ +inherited: true +owners: + - sterni diff --git a/nix/utils/default.nix b/nix/utils/default.nix new file mode 100644 index 000000000000..33f72e39039b --- /dev/null +++ b/nix/utils/default.nix @@ -0,0 +1,24 @@ +{ 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 + ; +} |