I’m using nix
for a number of projects, but I’m not running NixOS. My nix store is getting quite bloated, I presume there’s a lot of old cruft in there I’ll never use again. I want to remove all old builds, but I don’t want to remove anything I’m currently using.
I was thinking a way to do this was to:
- Enter a
nix develop
shell with all my current projects in separate terminals (withmaster
checked out, for example). - Run
nix-store --gc
.
Would the active nix develop
shells prevent any packages used by the current master branch of my projects being eaten up by the garbage collector?
But then I have the issue that I’d probably like to save any packages that are produced by a nix build
of my respective projects also. I’m not sure how to force the garbage collector to respect any packages required by a nix build
?
I basically don’t want to rebuild anything I’m “currently” using, but don’t care if packages built years ago get GCed.
Anyway to do this?