Hi! I’m using HP Pavillion Gaming 15 laptop with 256Gb SSD. I have installed NixOS 20.03 to this drive and gave it 25Gb as I always did with Debian before. /home is the other partition so I had 25Gb for system only. But after 3 month of great experience it turns out that I can’t nixos-rebuild switch because I have not enough space. I did nix-collect-garbage -d and nix-store --optimize. / is using 80% of storage for now and can’t rebuild.
After googling the topic I concluded that there is no way to widen /nix/store space by mounting another partition somehow. Also I don’t want to use another computer to build my system. So I decided to reinstall NixOS properly this time.
The question is how much storage should I give to the system? I mean how large can system grow during the rebuild? From big software I use only Plasma, Firefox, VSCode and LibreOffice. But what if I decide to install CLion? What amount of storage can make me sure it’s enough to rebuild pure system?
Is it relevant to separate /home when you have only 256Gb of space with NixOS?
I just bought a terabyte hard drive just for nix so I can basically ignore this problem.
Do you use home manager? Be sure to delete it’s generations as well. Same goes for lorri, direnv persistent shell, or anything else that creates gc roots.
## hope you're using bash
##
zGenerationsInDaysToBeDeleted=22 ## my individual preference of having the 22 days available; adjust to your personal needs
#
nix-collect-garbage -d --delete-older-than ${zGenerationsInDaysToBeDeleted}
Semi-related question: Can’t we have a service which auto-collects garbage?
I mean, we can set up a threshold as days (or better, keep last N) and remove generations + run nix-collect-garbage every 2 days or so with a systemd timer.
Does it ever removes something which an active generation needs? Or are there more things to consider?
Shouldn’t the real answer be “it depends”? As it is for every other distribution as well?
Of course, nix is a bit more hungry for disk space, but it also brings tools like garbage collection and store optimisation to mitigate.
Also a huge difference compared to other systems, nixOS has all those different versions of language compilers in the store. It’s not that they get installed and managed by some third party tool within the users home.
So, if one does do much, store consumption will be much higher than for those who just want their WM and VLC to watch a video here and there.
I never did as well, for “classic” filesystems, though with BTRFS (back on Arch) and ZFS (now on nixOS) I really like to have each subfolder of /home as its own subvolume for more granular snapshotting, as well as having the store in its own volume, to have it compressed.
Not to speak about the quota assigned to my sons $HOME to avoid him spilling my precious diskspace