diff --git a/src/libstore/include/nix/store/profiles.hh b/src/libstore/include/nix/store/profiles.hh index 577f2bb74..c5c5d9de2 100644 --- a/src/libstore/include/nix/store/profiles.hh +++ b/src/libstore/include/nix/store/profiles.hh @@ -145,7 +145,8 @@ void deleteGenerations(const Path & profile, const std::set & * - olderThan is 2025-09-16, keepMin is 5, keepMax is 10 - * Will try to delete generations older than 2025-09-16. * If there are more than 10 generations to be kept, continues to delete old generations until there are 10. - * If there are less than 5 generations to be kept, preserves the most recent of generations to be deleted until there are 5. + * If there are less than 5 generations to be kept, preserves the most recent of generations to be deleted until there + * are 5. * * @param profile The profile, specified by its name and location combined into a path, whose generations we want to * delete. @@ -161,7 +162,12 @@ void deleteGenerations(const Path & profile, const std::set & * * @param dryRun Log what would be deleted instead of actually doing so. */ -void deleteGenerationsFilter(const Path & profile, std::optional olderThan, std::optional keepMin, std::optional keepMax, bool dryRun); +void deleteGenerationsFilter( + const Path & profile, + std::optional olderThan, + std::optional keepMin, + std::optional keepMax, + bool dryRun); /** * Delete generations older than `max` passed the current generation. diff --git a/src/libstore/profiles.cc b/src/libstore/profiles.cc index 58458f69e..311665d46 100644 --- a/src/libstore/profiles.cc +++ b/src/libstore/profiles.cc @@ -163,7 +163,12 @@ static inline void iterDropUntil(Generations & gens, auto && i, auto && cond) ; } -void deleteGenerationsFilter(const Path & profile, std::optional olderThan, std::optional keepMin, std::optional keepMax, bool dryRun) +void deleteGenerationsFilter( + const Path & profile, + std::optional olderThan, + std::optional keepMin, + std::optional keepMax, + bool dryRun) { if (keepMin.has_value() && keepMax.has_value() && *keepMin > *keepMax) throw Error("--keep-min cannot be greater than --keep-max"); diff --git a/src/nix/nix-collect-garbage/nix-collect-garbage.cc b/src/nix/nix-collect-garbage/nix-collect-garbage.cc index adc25b92a..0f8b4393a 100644 --- a/src/nix/nix-collect-garbage/nix-collect-garbage.cc +++ b/src/nix/nix-collect-garbage/nix-collect-garbage.cc @@ -80,14 +80,15 @@ static int main_nix_collect_garbage(int argc, char ** argv) removeOld = true; else if (*arg == "--delete-older-than") { removeOld = true; - deleteOlderThan = std::optional { parseOlderThanTimeSpec(getArg(*arg, arg, end)) }; + deleteOlderThan = std::optional{parseOlderThanTimeSpec(getArg(*arg, arg, end))}; } else if (*arg == "--keep-min") - keepMin = std::optional { std::max(getIntArg(*arg, arg, end, false), (GenerationNumber) 1) }; + keepMin = std::optional{ + std::max(getIntArg(*arg, arg, end, false), (GenerationNumber) 1)}; else if (*arg == "--keep-max") { removeOld = true; - keepMax = std::optional { std::max(getIntArg(*arg, arg, end, false), (GenerationNumber) 1) }; - } - else if (*arg == "--dry-run") + keepMax = std::optional{ + std::max(getIntArg(*arg, arg, end, false), (GenerationNumber) 1)}; + } else if (*arg == "--dry-run") dryRun = true; else if (*arg == "--max-freed") options.maxFreed = std::max(getIntArg(*arg, arg, end, true), (int64_t) 0);