Hello
I have a 40 GB server and my store is 26 GB big so I need to make some space.
I already did:
sudo rm /run/booted-system
sudo rm /nix/var/nix/gcroots/auto/*
sudo nix-collect-garbage -d
sudo nix-store --optimise
Here are the 15 biggest store paths:
❯ sudo du -sh /nix/store/* | sort -hr | head -n 15
1.9G /nix/store/x1b3zc6mz3qwv33illj7rmri1vq3w3mj-ghc-binary-8.10.7
1.6G /nix/store/xbq6cqqiibnjqfw13g3wrmc422c8854x-ghc-9.0.2
891M /nix/store/c8vk231dg7p72kavkp44m6f44pwjhld3-source
854M /nix/store/qb90xrcx6cn18gicpwysg84way2yvjm2-source
846M /nix/store/bb31257f8d8b4pipnqgpf23hcjpnk67k-rustc-1.63.0
683M /nix/store/af31ls6z3r51gd0yhricblr9gx2qp64p-llvm-src-14.0.6
681M /nix/store/26lg59zjav1irl0znfx5rx3liv47n1r7-source
653M /nix/store/xwlps0yr4zvkr8yc236498qqd6xkvgj0-source
652M /nix/store/p9kzd1np5g2q13alw7l9hpiiydgnyi2r-clang-14.0.6-lib
633M /nix/store/ys42n4m9vpw0cs04c407nyk336g4brqs-gdb-12.1
618M /nix/store/5qyjmd1c52bzhbyxcy3kll5hi4zlwbnm-ghc-9.0.2-doc
606M /nix/store/fh99h1c7p8khsan0paca8p2vlyrx54g2-rustc-1.63.0-doc
546M /nix/store/p2kb2whrhxydnmzq8xv71lvf05w3fwh5-clang-11.1.0-lib
490M /nix/store/2msq36arf15jv424bldfq4spxyas5pdm-go-1.19.2
421M /nix/store/9bbzszb1qiqxb8zjg05h0liz1i1wlq37-ocaml-4.14.0
The gc roots:
❯ sudo nix-store --query --roots /nix/store/x1b3zc6mz3qwv33illj7rmri1vq3w3mj-ghc-binary-8.10.7
/proc/108711/environ -> /nix/store/x1b3zc6mz3qwv33illj7rmri1vq3w3mj-ghc-binary-8.10.7
/proc/108715/environ -> /nix/store/x1b3zc6mz3qwv33illj7rmri1vq3w3mj-ghc-binary-8.10.7
/nix/var/nix/profiles/per-user/sweenu/sweenu-7-link -> /nix/store/p4va1g03aqxppd3zd1gmsigvj3k6h3rg-activatable-home-manager-generation
/nix/var/nix/profiles/system-98-link -> /nix/store/06vgpjfpklcpv5pghba409fdviqxxhb4-activatable-nixos-system-benoni-22.11.20221008.c592415
/nix/var/nix/profiles/per-user/sweenu/home-manager-41-link -> /nix/store/zvzi40b8rz4z1n6w5jvp35fa8abr0kiq-home-manager-generation
/nix/var/nix/gcroots/per-user/sweenu/current-home -> /nix/store/zvzi40b8rz4z1n6w5jvp35fa8abr0kiq-home-manager-generation
/run/current-system -> /nix/store/z7kfsabwg5hx3cmz4y7cd84jgjscfi6k-nixos-system-benoni-22.11.20221008.c592415
So then I try to understand why it depends on my system:
❯ nix why-depends /run/current-system /nix/store/x1b3zc6mz3qwv33illj7rmri1vq3w3mj-ghc-binary-8.10.7
'/nix/store/z7kfsabwg5hx3cmz4y7cd84jgjscfi6k-nixos-system-benoni-22.11.20221008.c592415' does not depend on '/nix/store/x1b3zc6mz3qwv33illj7rmri1vq3w3mj-ghc-binary-8.10.7'
It doesn’t . So I am quite confused.
What’s even more. If I use nix-tree (sudo nix-tree
) I get these two parent closures:
nixos-system-benoni-22.11.20221008.c592415 2.95 GiB (2.95 GiB)
profile 191.53 MiB (191.53 MiB)
The closure size is 10 times smaller that what my nix store actually weights and I can not find any trace of ghc or rust or go or ocaml or anything else that takes so much space in my store.
And finally, here’s a referrers query:
❯ nix-store --query --referrers /nix/store/x1b3zc6mz3qwv33illj7rmri1vq3w3mj-ghc-binary-8.10.7
/nix/store/x1b3zc6mz3qwv33illj7rmri1vq3w3mj-ghc-binary-8.10.7
So how to find out why those paths are there and how to know which of my explicitly installed packages (in environment.defaultPackages) I should remove to free the most space I could?