Lazy trees
Available since Determinate Nix 3.5.2.You can read more about that version's release on our blog.
Lazy trees provide faster and less resource-intensive evaluation in many standard flake usage scenarios.
With lazy trees enabled, Nix scopes file copying to what the specific expression demands—and nothing more.
More specifically, Nix uses a virtual filesystem to gather the necessary file state prior to copying anything to the Nix store, “mounting” lazy source inputs to this virtual filesystem at /nix/store/<random-hash>.
This much more parsimonious mode of operation quietly makes just about everything in Nix faster, from standard package builds to development environments to NixOS deployment and beyond.
Lazy trees make an especially large performance impact in large repositories, including massive monorepos. For evaluations inside of the Nixpkgs repo, for example, we’ve frequently seen reductions in wall time of 3x or more and reductions in disk usage of 20x or more—and occasionally reductions far beyond even this.
Lazy trees are currently stable in Determinate Nix and enabled by default for all users.
You can disable lazy trees for a single operation—perhaps for testing performance differences with the feature enabled and disabled—by applying the --no-lazy-trees flag:
nix build --no-lazy-trees .#my-packageAlthough we don’t recommend it, you can disable lazy trees on your system by adding this to your nix.custom.conf file:
lazy-trees = falseIf you’re an administrator and would like to disable lazy trees on an organization-wide basis, contact us at support@determinate.systems.