refactor(readTree): Pass all readTree parameters as function args

Instead of having a mix of depot-passed args (for the filter) and args
to the readTree function itself, make everything a single attribute
set of arguments passed to the function.

This also makes it a bit easier to extend this in the future.

Change-Id: I633c1fc96026d137b451bb604ef92be32571a0f5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3498
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2021-09-08 18:16:11 +03:00 committed by tazjin
parent 4c4aa8e413
commit aedde913d1
4 changed files with 53 additions and 24 deletions

View file

@ -70,8 +70,13 @@ the tree as empty nodes (`{}`).
## Import structure
`readTree` is called with two parameters: The arguments to pass to all imports,
and the initial path at which to start the traversal.
`readTree` is called with an argument set containing a few parameters:
* `path`: Initial path at which to start the traversal.
* `args`: Arguments to pass to all imports.
* `filter`: (optional) A function to filter the argument set on each
import based on the location in the tree. This can be used to, for
example, implement a "visibility" system inside of a tree.
The package headers in this repository follow the form `{ pkgs, ... }:` where
`pkgs` is a fixed-point of the entire package tree (see the `default.nix` at the