I’m not using NixOS but do have a project built using flake.nix
. I generally go nix develop
and then nix build
to build the project. Over time my store has been growing. I’d like to garbage collect old store paths, but without having to rebuild the world next time I run nix develop
.
I’m guessing that whenever I do a nix build
, nix marks the package I’m going to build as a “root”, so if nix store --gc
is run at the same time, it doesn’t trash packages that are currently in use. If there’s a timestamp on this marking, it should be relatively easy to work out the recency of each store path, by just defining the store path recency as the most recent recency anything that depends on it.
Does this information exist, and is there a way to use it to delete all store paths that are say, more than a month old, but keep everything else intact? I did see the option –delete-older-than, but this relates to profiles, which would do the job if every time I run nix develop
a profile is created and stored but I’m not sure that’s the case.