I have a nixConfiguration flake for multiple machine. The flake is pretty big, it include everything like home-manager as nixos module.
Every time I running nixos-rebuild switch it start evaluating(?) the flake and it takes multiple minutes (mostly 3-4minutes) before it actually building/copying files. So it is very time consuming to test some even minor configuration changes.
My main PC is about 8 years old. Is evaluating with 4 minutes every time considered normal?
Thanks!
If you have many inputs, each with their own different version of nixpkgs, it might help to use the follows thing to reuse one nixpkgs across inputs. This should reduce eval time.
2 minutes sounds extremely excessive. You’d need to be evaluating the entire nixpkgs a good dozen times to get there.
Also keep an eye out for import nixpkgs, and check that you’re not thrashing - evaluating many nixpkgs instances is very memory hungry, and should be avoided.
Share your config if you can, or at least your flake.nix.
Thanks!
Now I refactor my flake only using nixos-25.05 (before it have nixos-unstable and master branch), and removing the applyPatch here (which cost about 30s evaluation time), now my flake only evaluate in 1 minutes 15 seconds.
Thanks so much for the advice!