Skip to content

Instantly share code, notes, and snippets.

View bryanasdev000's full-sized avatar

Bryan A. S. bryanasdev000

View GitHub Profile
@bryanasdev000
bryanasdev000 / trim-generations.sh
Created May 25, 2023 05:39 — 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"