I made a mistake in building something on NixOS that filled the whole disk. After that, I ran nix store gc which was another mistake since I got an output that there was data to remove but I also got an SQLite error due to full disk.
I solved that by removing systemd journal logs and running nix store gc and thankfully I didn’t break anything and the NixOS instance still works just fine (thank you, developers!!!).
I have 2 almost identical NixOS instances. Looking at the one that had this problem it’s clear that some Nix paths were supposed to be removed but they were not deleted. In other words both NixOS instances have almost identical generations, but the other NixOS instance has less data in /nix even after running nix store gc on both of them.
Could you please tell me, if is it possible to properly GC the first one too? Or maybe somehow fix the DB?
I’m not getting DB errors. I can rebuild the system without problem.
I’ve just run alias nix-stray-roots='nix-store --gc --print-roots | grep -vE "^(/nix/var|/run/\w+-system|\{memory|\{censored|/proc/maps/)"' and I get a large number of paths. 1831 on the broken NixOS and 1821 on the other one. Should I compare the instances and run nix store delete to remove paths that don’t need to be kept?