aboutsummaryrefslogtreecommitdiff
path: root/src/nix-env
diff options
context:
space:
mode:
authorMatthew O'Gorman <mog@rldn.net>2016-01-06 20:15:19 -0500
committerMatthew O'Gorman <mog@rldn.net>2018-03-01 21:47:57 -0500
commit429154b74c7f4b4d679ae79bbc939049f537bfaf (patch)
tree8f393c37c7138cf16a23c2e364b9f5f0bcd765a1 /src/nix-env
parent4a000cbb39766812fccebfa7cf8b76ecca8f6e63 (diff)
Implement --delete-generations + flag for keeping last N number of generations
Diffstat (limited to 'src/nix-env')
-rw-r--r--src/nix-env/nix-env.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index 97e66cbd9..1440b7744 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -1284,6 +1284,8 @@ static void opDeleteGenerations(Globals & globals, Strings opFlags, Strings opAr
deleteOldGenerations(globals.profile, globals.dryRun);
} else if (opArgs.size() == 1 && opArgs.front().find('d') != string::npos) {
deleteGenerationsOlderThan(globals.profile, opArgs.front(), globals.dryRun);
+ } else if (opArgs.size() == 1 && opArgs.front().find('+') != string::npos) {
+ deleteGenerationsGreaterThan(globals.profile, opArgs.front(), globals.dryRun);
} else {
std::set<unsigned int> gens;
for (auto & i : opArgs) {