aboutsummaryrefslogtreecommitdiff
path: root/src/nix-collect-garbage
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-collect-garbage')
-rw-r--r--src/nix-collect-garbage/nix-collect-garbage.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nix-collect-garbage/nix-collect-garbage.cc b/src/nix-collect-garbage/nix-collect-garbage.cc
index cb1f42e35..70af53b28 100644
--- a/src/nix-collect-garbage/nix-collect-garbage.cc
+++ b/src/nix-collect-garbage/nix-collect-garbage.cc
@@ -41,9 +41,10 @@ void removeOldGenerations(std::string dir)
}
if (link.find("link") != std::string::npos) {
printInfo("removing old generations of profile %s", path);
- if (deleteOlderThan != "")
- deleteGenerationsOlderThan(path, deleteOlderThan, dryRun);
- else
+ if (deleteOlderThan != "") {
+ auto t = parseOlderThanTimeSpec(deleteOlderThan);
+ deleteGenerationsOlderThan(path, t, dryRun);
+ } else
deleteOldGenerations(path, dryRun);
}
} else if (type == DT_DIR) {