From a5591359702b62e4edd7fdbbd135475037aa6727 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 12 Apr 2021 21:49:36 +0200 Subject: refactor(readTree): Initialise repo roots without recursing Plumbs an additional internal argument through readTree that indicates whether the top-level of a tree is being read, and avoids recursing into itself in that case. This changes the externally visible behaviour of readTree (it is now expected to be called a level higher than previously). This allows us to reduce the amount of boilerplate needed to bootstrap the TVL repository (by not having to specify the individual folders that need to be read). For reasons related to an infinite recursion we could not (be bothered to) debug, the top-level `config` key (which held the attribute set passed on by readTree) has been removed. This is not needed, as it is already passed on by readTree ... Co-Authored-By: Florian Klink Change-Id: Id6e39b57b2f5b3473c4b695a72dd1d01fcfb7a66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2961 Tested-by: BuildkiteCI Reviewed-by: sterni Reviewed-by: grfn --- nix/readTree/README.md | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nix/readTree/README.md') diff --git a/nix/readTree/README.md b/nix/readTree/README.md index c93cf2bfdd..138abbe305 100644 --- a/nix/readTree/README.md +++ b/nix/readTree/README.md @@ -60,6 +60,9 @@ with some exceptions: * If a folder contains a `default.nix` it is loaded and, if it evaluates to a set, *merged* with the children. If it evaluates to anything else the children are *not traversed*. +* The `default.nix` of the top-level folder on which readTree is + called is **not** read to avoid infinite recursion (as, presumably, + this file is where readTree itself is called). Traversal is lazy, `readTree` will only build up the tree as requested. This currently has the downside that directories with no importable files end up in -- cgit 1.4.1