Zero Dependencies
A single default.nix. Usable as a flake or plain import. No extra inputs needed.
import-tree recursively discovers and imports Nix files from a directory tree. It works with NixOS, nix-darwin, home-manager, flake-parts, NixVim, and any Nix module system.
# In your flake.nix — import every .nix file under ./modules{ inputs.import-tree.url = "github:vic/import-tree"; inputs.flake-parts.url = "github:hercules-ci/flake-parts";
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules);}Paths containing /_ are ignored by default — use underscored directories for private helpers.
Zero Dependencies
A single default.nix. Usable as a flake or plain import. No extra inputs needed.
Sensible Defaults
Recursively finds .nix files, skips /_ prefixed paths. Works out of the box.
Builder API
Chain .filter, .match, .map, .addPath, and more to customize discovery.
Extensible
Add your own API methods with .addAPI to create domain-specific import-tree instances.