I haven’t updated my NixOS system in a long time, so I was surprised by the size of the update when I started it today.
I used the following commands:
sudo nix flake update
sudo nixos-rebuild switch --upgrade --flake .
After leaving my computer for a while, I returned to find it had frozen. The fans were running, but the screen was stuck on the package building phase. I had to force a shutdown by holding the power button.
Upon restarting, I ran the update again, this time monitoring the process with btop
. I noticed that the build process was consuming all of my available RAM, which leads me to believe the crash was caused by an out-of-memory (OOM) error.
I found a suggestion online to limit the resource usage with the --max-jobs 1
flag:
sudo nixos-rebuild switch --upgrade --max-jobs 1 --flake .
but this still does not really help. I have not run out of memory yet but resource usages are still really high.
Here is a btop
screenshot showing the memory usage even with the flag enabled:
I’ve never encountered this issue before. Can anyone help me resolve this?