fix(read-tree): Don't import default.nix
sibling expression
If a folder contains a `default.nix`, Nix expressions contained in adjacent files should not be imported (they might be things like a `shell.nix` or a `deps.nix` which do not evaluate to derivations). The tree traversal still continues for all children folders of a folder with a `default.nix`.
This commit is contained in:
parent
7044424f52
commit
ff38ae6c5f
1 changed files with 5 additions and 3 deletions
|
@ -72,10 +72,12 @@ let
|
||||||
in listToAttrs (imported ++ dirs);
|
in listToAttrs (imported ++ dirs);
|
||||||
|
|
||||||
importOr = path: dir: f:
|
importOr = path: dir: f:
|
||||||
let contents = f path (attrsToList dir);
|
let
|
||||||
|
allContents = f path (attrsToList dir);
|
||||||
|
dirOnlyContents = f path (filter (f: f.value == "directory") (attrsToList dir));
|
||||||
in if dir ? "default.nix"
|
in if dir ? "default.nix"
|
||||||
then import path (argsWithPath args (pathParts path)) // contents
|
then import path (argsWithPath args (pathParts path)) // dirOnlyContents
|
||||||
else contents;
|
else allContents;
|
||||||
|
|
||||||
readTree = path: importOr path (readDir path) traverse;
|
readTree = path: importOr path (readDir path) traverse;
|
||||||
in readTree initPath
|
in readTree initPath
|
||||||
|
|
Loading…
Reference in a new issue