1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-18 02:58:27 +02:00

nix-env: Minor change to '--delete-generations Nd' semantics

The option '--delete-generations Nd' deletes all generations older than N
days. However, most likely the user does not want to delete the
generation that was active N days ago.

For example, say that you have these 3 generations:

1: <30 days ago>
2: <15 days ago>
3: <1 hour ago>

If you do --delete-generations 7d (say, as part of a cron job), most
likely you still want to keep generation 2, i.e. the generation that was
active 7 days ago (and for most of the past 7 days, in fact).

This patch fixes this issue. Note that this also affects
'nix-collect-garbage --delete-older-than Nd'.

Thanks to @roconnor for noticing the issue!
This commit is contained in:
Ricardo M. Correia 2014-04-11 17:10:20 +02:00 committed by Eelco Dolstra
parent fb5d76b89e
commit 700c678c2e
3 changed files with 15 additions and 7 deletions

View file

@ -45,8 +45,9 @@ which deletes all old generations of all profiles in
impossible); and
<option>--delete-older-than</option> <replaceable>period</replaceable>,
where period is a value such as <literal>30d</literal>, which deletes
all non-current generations that are older than the specified number of
days in all profiles in <filename>/nix/var/nix/profiles</filename>.
all generations older than the specified number of days in all profiles
in <filename>/nix/var/nix/profiles</filename> (except for the generations
that were active at that point in time).
</para>
</refsection>