I use NixOS as my main OS on multiple machines now, and I have a very annoying problem with it: after some use, packages take soooo loooong to install even from cache.nixos.org with fast connection. The thing that takes the longest during the installation is building '/nix/store/…-user-environment.drv'
. For example, installing Polari took me 3856 seconds (I’m using nixos-18.03 as the channel, so Polari was pre-built by hydra). This is ridiculous. I understand that the time it takes to build user environment depends on amount of installed packages, but nix-env -q
gives such a long and undetailed list that it would be very hard and tiring to dig through, pick out unneeded packages and copy-paste them to nix-env -e …
. It would be just so much nicer if there was some tool like synaptic or aptitude, which would allow to just mark some packages for deletion and then execute. I am aware of NixUI, but for some reason it doesn’t work for me (left it overnight loading packages in my profile - never got there).
Or maybe I am just doing something wrong and there already is a tool/way to do what I need?
Thanks in advance.
- The environments do take rather long on slow-seeking drives, but I’ve never seen anything on the order of thousands of seconds.
- There is some work on nix backend for packagekit, usable in programs like “gnome software”, but I don’t know the status/usability.
Yes, more than an hour is quite long for one package.
Although in defence of Nix, my environment is very piled up, and also it’s only the first build of user-environment after reboot that takes so long, after that it “speeds up” to about 500-1000 sec. This is still ridiculous. Currently I am cleaning up by hand.
As of packagekit, as I see it, the work has been abandoned: it isn’t building since 17.09.
If you have the list of packages that you actually care about collected into one meta-package or named environment, you can do this to build a nix env that has ONLY the things you specify:
$ nix-env -riA nixos.myEnv
The --remove-all (-r) flag will remove everything not included in myEnv atomically, which allows you to manage your environments in a fully declarative way.
Thanks Benjamin, I did that (though not with meta-packages, but with home-manager).
At NixCon 2015, one of the speakers showed us a GUI he built that was doing all of these things. It was extracting the package names and description, allowed you to install and uninstall packages. It also looked really good!
That’s the last time I heard of that project unfortunately, I wonder what happened to it.
Maybe that was NixUI? If so, it’s great, but too many packages (as in my case) make it hang and terminate, unfortunately.