How do you imperatively garbage collect nix these days? (nix 2.4)

I’m test driving the nix 2.4 release candidate and it is wonderful!

I’m curious about how to garbage collect the nix store (/nix/store).
In the past I ran nix-collect-garbage -d. I might have also manually debugged which derivations held on to references too.

So how do you garbage collect the nix store these days?

I found nix store gc. Is that the equivalent or are there other things I should be doing?

You can still do nix-collect-garbage -d.

Is there an equivalent for the new nix CLI yet is probably the real question here :slight_smile:


well I think the already mentioned nix store gc works, but it doesn’t have an option comparable to -d to remove old generations.

1 Like


I’m fishing for what I should use over what I have used in the past.

1 Like

I don’t see why one shouldn’t use nix-collect-garbage tbh, especially considering that the Nix CLI is considered experimental in 2.4 and thus subject to change.

1 Like
Hosted by Flying Circus.