so I have been using nixos for month and a half now, I made the root partition 85 GB, the partition grew big when I installed hyprland with the gnome setup I already have, and all of the software packages I use, I then removed hyprland config, and now the system got only 13 GB free, even though I am using gnome only, and used “sudo nix-collect-garbage -d”.
When I do “sudo nixos-rebuild switch --upgrade” and it uses the 13GB and then says “error: writing to file: No space left on device”, so I am unable to upgrade my packages.
What should I do ?
I would really prefer not mounting the nix store in another partition and leave it on root.
Well, I solved my issue by removing programs one by one which seems to take a lot of space like (discord, blender, etc)
do the system upgrade, then garbage collect then add these programs again.
also any program that builds, may require a lot of storage to build successfully then clean itself.
You can use nix-tree to closer analyse disk usage of a closure.
Additionally, you can use nix-store --gc --print-roots to find stray GC roots that might be preventing a huge amount of paths from being garbage-collected. I use this alias:
alias nix-stray-roots='nix-store --gc --print-roots | egrep -v "^(/nix/var|/run/\w+-system|\{memory|\{censored|/proc/maps/)"'