ParentFull threadcp9·nix comes with a tool called nix-collect-garbage which takes care of this for youView on HN