Skip to content

Instantly share code, notes, and snippets.

@Artturin
Artturin / trim-generations.sh
Created August 31, 2023 15:52 — forked from Bondrake/trim-generations.sh
NixOS script to keep 10 generations or 7 days, whichever is more (configurable, profile is selectable)
#!/usr/bin/env bash
set -euo pipefail
## Defaults
keepGensDef=10; keepDaysDef=7
keepGens=$keepGensDef; keepDays=$keepDaysDef
## Usage
usage () {
printf "Usage:\n\t trim-generations.sh (defaults are: Keep-Gens=$keepGensDef Keep-Days=$keepDaysDef Profile=user)\n\n"