diff options
author | Théophane Hufschmitt <theophane.hufschmitt@tweag.io> | 2023-04-03 15:13:11 +0200 |
---|---|---|
committer | Théophane Hufschmitt <theophane.hufschmitt@tweag.io> | 2023-05-15 11:36:53 +0200 |
commit | 64b0cc5bc40db052a4eff15c6d1ed8e1efafcd0d (patch) | |
tree | 92f777111e30a8497bee580522d9482ccaf211e2 /src | |
parent | b15cba03c394962f274852d08f9274249afe0f49 (diff) |
Make `nix-collect-garbage -d` look into more places
Make it look into the new-style profiles dir, the old-style one, and the
target of `~/.nix-profile` to be sure that we don't miss anything
Diffstat (limited to 'src')
-rw-r--r-- | src/nix-collect-garbage/nix-collect-garbage.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nix-collect-garbage/nix-collect-garbage.cc b/src/nix-collect-garbage/nix-collect-garbage.cc index 3cc57af4e..cb1f42e35 100644 --- a/src/nix-collect-garbage/nix-collect-garbage.cc +++ b/src/nix-collect-garbage/nix-collect-garbage.cc @@ -77,7 +77,12 @@ static int main_nix_collect_garbage(int argc, char * * argv) return true; }); - if (removeOld) removeOldGenerations(profilesDir()); + if (removeOld) { + std::set<Path> dirsToClean = { + profilesDir(), settings.nixStateDir + "/profiles", dirOf(getDefaultProfile())}; + for (auto & dir : dirsToClean) + removeOldGenerations(dir); + } // Run the actual garbage collector. if (!dryRun) { |