feat(readTree): Add special here argument.

It's convenient for depending on sub-tree members of the current file as
well as gives access to siblings.

Change-Id: I74234cec6566177d88d3bc8507fa3f6ec789adb8
Reviewed-on: https://cl.snix.dev/c/snix/+/30098
Reviewed-by: adis bladis <adisbladis@gmail.com>
Tested-by: besadii
This commit is contained in:
vkryachko 2025-03-18 13:30:08 +00:00 committed by Vova Kryachko
parent 39b3e2c410
commit a04c73ca83
7 changed files with 39 additions and 15 deletions

View file

@ -84,9 +84,15 @@ the tree as empty nodes (`{}`).
imported files via `builtins.scopedImport`. This will forcefully
override the given values in the import scope, use with care!
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
root of the depot).
The package headers in this repository follow the form
`{depot, pkgs, lib, here, ... }:` where:
* `depot` is a fixed-point of the entire package tree (see the `default.nix`
at the root of the depot).
* `pkgs` is the nixpkgs used in the repo, see `third_party/nixpkgs`
* `lib` is essentially a shortcut to `pkgs.lib` exposed for convenience
* `here` is a special argument that points to the current location in the
tree. Useful to avoid specifying dependencies from the very top of the `depot`
In theory `readTree` can pass arguments of different shapes, but I have found
this to be a good solution for the most part.