Tweak borg to remove long-term server backups
This commit is contained in:
parent
6b76c0a4f9
commit
7c995bfdce
|
@ -81,6 +81,10 @@ in {
|
||||||
description = "How often to run backups";
|
description = "How often to run backups";
|
||||||
default = "hourly";
|
default = "hourly";
|
||||||
};
|
};
|
||||||
|
keepForever = mkOption {
|
||||||
|
description = "Keep monthly backups forever";
|
||||||
|
default = config.nathan.config.isDesktop;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
# Nginx
|
# Nginx
|
||||||
nginx = {
|
nginx = {
|
||||||
|
|
|
@ -28,11 +28,16 @@ with lib; {
|
||||||
environment.BORG_RSH = "ssh -i ${config.nathan.services.borg.sshKey}";
|
environment.BORG_RSH = "ssh -i ${config.nathan.services.borg.sshKey}";
|
||||||
compression = "auto,zstd";
|
compression = "auto,zstd";
|
||||||
startAt = config.nathan.services.borg.startAt;
|
startAt = config.nathan.services.borg.startAt;
|
||||||
prune.keep = {
|
prune.keep = if config.nathan.services.borg.keepForever then {
|
||||||
within = "7d"; # Keep all archives for the past week
|
within = "7d"; # Keep all archives for the past week
|
||||||
daily = 1; # Keep 1 snapshot a day for 2 weeks
|
daily = 1; # Keep 1 snapshot a day for 2 weeks
|
||||||
weekly = 4; # Keep 1 snapshot a week for 4 weeks
|
weekly = 4; # Keep 1 snapshot a week for 4 weeks
|
||||||
monthly = -1; # Keep unlimited monthly backups
|
monthly = -1; # Keep unlimited monthly backups
|
||||||
|
} else {
|
||||||
|
within = "7d"; # Keep all archives for the past week
|
||||||
|
daily = 1; # Keep 1 snapshot a day for 2 weeks
|
||||||
|
weekly = 4; # Keep 1 snapshot a week for 4 weeks
|
||||||
|
monthly = 3; # Keep 3 monthly backups
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue