refactor(nix): Move mkLabel from buildkite to readTree
This function is more generically useful than just for pipeline construction. A subsequent commit will use it inside of readTree itself. Change-Id: I5eabd6f659726484667e060958865dddbc205762 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5237 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
98b6af02f5
commit
3bde425860
3 changed files with 15 additions and 10 deletions
|
|
@ -58,6 +58,13 @@ let
|
|||
__readTreeChildren = builtins.attrNames children;
|
||||
};
|
||||
|
||||
# Create a label from a target's tree location.
|
||||
mkLabel = target:
|
||||
let label = concatStringsSep "/" target.__readTree;
|
||||
in if target ? __subtarget
|
||||
then "${label}:${target.__subtarget}"
|
||||
else label;
|
||||
|
||||
# Merge two attribute sets, but place attributes in `passthru` via
|
||||
# `overrideAttrs` for derivation targets that support it.
|
||||
merge = a: b:
|
||||
|
|
@ -188,7 +195,7 @@ let
|
|||
isDerivation = x: isAttrs x && x ? type && x.type == "derivation";
|
||||
in
|
||||
{
|
||||
inherit gather;
|
||||
inherit gather mkLabel;
|
||||
|
||||
__functor = _:
|
||||
{ path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue