2 large files in nix store - how to remove them?

Hi,

I’m executing nix-du -s 500MB
and the two largest items are:

"nixos-system-nuc-01-20.03.1619.ab3adfe1c76 (1.34 GiB)"
"systemd-boot-builder.py (767.70 MiB)"

Yeah, Nixos is running on an Intel NUC but as a headless server and in the previous test installation that file wasn’t imho present. That installation was only 2.2GB large while this is about 3.9GB.

I’ve already executed nix-collect-garbage -d

Can I get rid of these two files (btw, a .py file with 767 MiB oO) somehow?

Hello,

systemd-boot-builder.py (767.70 MiB)

does not mean that this python file is 767 MB but that if you somehow get rid of all gc roots to this python file, 767 MB of dependencies will go away along with the python file.

See https://github.com/symphorien/nix-du/blob/master/README.md#interpreting-the-result for examples and details.

It’s hard to help you more without the full graph.

Hi,

here is the full graph. Quite a hassle to get an .svg online…

https://gist.githubusercontent.com/oO0XX0Oo/99c1f3be9780e9d221b4394319cc1c8e/raw/aadb7e3562aee2769b3f03993ff54f4faf361f8e/result.svg

So you cannot get rid of nixos-system-nuc-01-20.03.1619.ab3adfe1c76 (1.34 GiB) because it is the generation you booted from (you can see it because /run/booted-system depends on it).
You can’t remove the other node because it is the generation you are currently running (/run/current-system depends on it).

If you are confident that the current generation works fine, and want to free space by removing the old one, you can reboot, remove /result and run nix-collect-garbage. This should free about 1.3GB.

Thank you, symphorien!

Didn’t know all that. Down to 2.2 GB now :slight_smile:

Note that by aggressively removing old generations, you lose one of the main benefits of NixOS: rollbacks from the bootloader, in case everything breaks. It’s a treadoff with disk-space :slight_smile:

I know but the good thing is that I could set it up (if really necessary) in no matter of time thanks to its declarative nature :star_struck:

1 Like