boreal: prune backups older than a month

This commit is contained in:
Antoine Martin 2021-05-04 01:32:37 +02:00
parent bc74de3fc6
commit 71c4871af0
2 changed files with 21 additions and 5 deletions

View file

@ -47,6 +47,14 @@ in
borg-backup = { borg-backup = {
enable = true; enable = true;
repo = secrets.borg-backup.boreal-repo; repo = secrets.borg-backup.boreal-repo;
# for a workstation, having backups spanning the last month should be
# enough
prune = {
keep = {
daily = 7;
weekly = 4;
};
};
paths = [ paths = [
"/home/alarsyo" "/home/alarsyo"
]; ];

View file

@ -14,6 +14,18 @@ in {
description = "Borgbase repo info. Required."; description = "Borgbase repo info. Required.";
}; };
prune = mkOption {
type = types.attrs;
default = {
keep = {
daily = 7;
weekly = 4;
monthly = 6;
};
};
description = "pruning options for borg";
};
paths = mkOption { paths = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [];
@ -57,11 +69,7 @@ in {
doInit = true; doInit = true;
compression = "auto,zstd"; compression = "auto,zstd";
startAt = "daily"; startAt = "daily";
prune.keep = { prune = cfg.prune;
daily = 7;
weekly = 4;
monthly = 6;
};
}; };
}; };
} }