import-tree
import-tree copied to clipboard
`import-tree` return incorrect file list for directory contain `default.nix`
When I call import-tree on directory contain default.nix, it incorrectly return each files in the directory instead of directory itself.
Example file structure:
modules/
subdir/
default.nix
a.nix
b.nix
Expected behaviour
I expect following code
{lib, config, ...} {
imports = [ (import-tree ./modules) ];
}
Is similar to
{lib, config, ...} {
imports = [
{
imports = [ ./modules/subdir ];
}
];
}
Actual behaviour
import-tree returns each files in the directory.
{lib, config, ...} {
imports = [
{
imports = [
./modules/subdir/default.nix
./modules/subdir/a.nix
./modules/subdir/b.nix
];
}
];
}
This is not a bug. This is the expected documented behaviour. Any nix file is included. If you want to skip some file, read the docs on how to use filter.