NixOS Generations Trimmer: Difference between revisions
imported>Mike1 m New output shows defaults |
imported>Mike1 m New confirm option added |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 23: | Line 23: | ||
<syntaxHighlight lang=bash> | <syntaxHighlight lang=bash> | ||
❯ ./trim-generations.sh | ❯ ./trim-generations.sh | ||
The current defaults are: | |||
Keep-Gens=30 Keep-Days=30 | |||
Keep these defaults? (y/n):y | |||
Using defaults.. | |||
Keeping default: 30 generations OR 30 days, whichever is more | Keeping default: 30 generations OR 30 days, whichever is more | ||
Operating on profile: | Operating on profile: /nix/var/nix/profiles/per-user/dougal/profile | ||
oldest generation: | oldest generation: 75 | ||
oldest generation created: | oldest generation created: 2023-08-05 | ||
minutes before now: | minutes before now: 46740 | ||
hours before now: | hours before now: 779 | ||
days before now: | days before now: 32 | ||
current generation: 217 | |||
current generation created: 2023-09-06 | |||
minutes before now: 660 | |||
hours before now: 11 | |||
days before now: 0 | |||
Something to do... | |||
Found the following generation(s) to delete: | |||
generation 75 2023-08-05, 32 day(s) old | |||
generation 76 2023-08-05, 32 day(s) old | |||
generation 77 2023-08-05, 32 day(s) old | |||
generation 78 2023-08-05, 32 day(s) old | |||
generation 79 2023-08-05, 32 day(s) old | |||
generation 80 2023-08-05, 32 day(s) old | |||
generation 81 2023-08-05, 32 day(s) old | |||
generation 82 2023-08-05, 32 day(s) old | |||
generation 83 2023-08-05, 32 day(s) old | |||
generation 84 2023-08-05, 32 day(s) old | |||
generation 85 2023-08-05, 32 day(s) old | |||
generation 86 2023-08-05, 32 day(s) old | |||
Do you want to delete these? [Y/n]: | |||
</syntaxHighlight> | </syntaxHighlight> | ||
| Line 80: | Line 103: | ||
Usage: | Usage: | ||
./trim-generations.sh <keep-gernerations> <keep-days> <profile> | |||
(defaults are: Keep-Gens=30 Keep-Days=30 Profile=user) | |||
If you enter any parameters, you must enter all three, or none to use defaults. | |||
Example: | Example: | ||
trim-generations.sh 15 10 home-manager | |||
this will work on the home-manager profile and keep all generations from the | |||
last 10 days, and keep at least 15 generations no matter how old. | |||
Profiles available are: user, home-manager, channels, system (root) | |||
-h or --help prints this help text. | |||
</syntaxHighlight> | </syntaxHighlight> | ||
| Line 151: | Line 179: | ||
Usage: | Usage: | ||
./trim-generations.sh <keep-gernerations> <keep-days> <profile> | |||
(defaults are: Keep-Gens=30 Keep-Days=30 Profile=user) | |||
If you enter any parameters, you must enter all three, or none to use defaults. | |||
Example: | Example: | ||
trim-generations.sh 15 10 home-manager | |||
this will work on the home-manager profile and keep all generations from the | |||
last 10 days, and keep at least 15 generations no matter how old. | |||
Profiles available are: user, home-manager, channels, system (root) | |||
-h or --help prints this help text. | |||
</syntaxHighlight> | </syntaxHighlight> | ||
[[Category:Tutorial]] | [[Category:Tutorial]] | ||