Nix is behaving really strange on a laptop that I recently setup with NixOS.
All nix commands takes forever to run, just to give a simple example:
[michel@michel-x1:~]$ time nix --version
nix (Nix) 2.4
real 0m23.751s
user 0m0.042s
sys 0m0.023s
[michel@michel-x1:~]$ time nix-channel --list
nixos https://nixos.org/channels/nixos-21.11
unstable https://nixos.org/channels/nixpkgs-unstable
real 0m23.479s
user 0m0.044s
sys 0m0.026s
I have been using NixOs for something like 4 years now, and I believe its the first time I experience nix being this crazy slow.
The things that I have tried so far to make nix fast again is:
- garbage collection and optimize.
- disable and remove ‘musnix’ from my config file and then ‘nixos-rebuild switch’ (GitHub - musnix/musnix: Real-time audio in NixOS).
- upgrade nix from version 2.3 to 2.4 by installing it from the unstable channel (https://nixos.org/channels/nixpkgs-unstable)
How do I troubleshoot and fix the problem with nix being so slow?
I don’t mind switching on some of that new fancy ‘flake’-thingy-stuff if that is what it takes (and if someone can guide me on to how to do that)… I have anyways started to familiarize myself a bit with ‘nix flake’ on my work machine on which I sadly have to run Windows but at least with linux in WSL… (nix --version in WSL, runs in ~10 seconds btw)
I don’t consider myself a very advanced NixOs-user, I have mostly just been happy with having a simple declarative configuration file with which I could quickly get a new laptop up and running with all the packages and setup that I like (I’ve done that at least 5-10 times over the past couple of years with no issues)… and then of course the ability to rollback easily and install stuff without worrying about library version problems… Using NixOs up to now has in general been quite enjoyable…