I’m harvesting some questions coming from newcomers (and not-so-new as well) and this appears more than I’d think it would, maybe we should state clearly in the manual that not only the store increase in size during normal operation but /boot
does as well if it is a separate partition.
The issue is that nixos-rebuild
removes old kernels if the generations referencing them have been garbage collected but the operation is done after the kernel of the generation you’re trying to switch/boot into is installed.
At the time I didn’t know this and installed NixOS on a small boot partition and haven’t move since then so this is the workflow I’ve developed. It assumes you’re a normal user with sudo privilege, if you’re not do everything as root.
Make sure you understand every step or you could end up with a non bootable system
- Do a
sudo nixos-rebuild build
so that you’re sure that the build of your current configuration can be carried out - Do a garbage collection to remove old system generations with
sudo nix-collect-garbage -d
- Manually make some space in boot. Find your kernels and
rm
them. - Run
sudo nixos-rebuild switch
orsudo nixos-rebuild boot
. This time your bootloader will be installed correctly along with the new kernel and initrd - Make sure point 4 was executed correctly by looking at the output and reboot
- [optional] remove the
result
directory created by point 1