2018-10-21 23:04:27 +02:00
|
|
|
{ config, ... }:
|
|
|
|
# back up all state
|
|
|
|
let
|
2023-06-22 00:07:21 +02:00
|
|
|
sshkey = config.sops.secrets."borg.priv".path;
|
|
|
|
phrase = config.sops.secrets."borg.pw".path;
|
2018-10-21 23:04:27 +02:00
|
|
|
in
|
|
|
|
{
|
2023-06-22 00:07:21 +02:00
|
|
|
sops.secrets."borg.priv" = {};
|
|
|
|
sops.secrets."borg.pw" = {};
|
|
|
|
|
2018-10-21 23:04:27 +02:00
|
|
|
services.borgbackup.jobs.state = {
|
|
|
|
repo = "borg-${config.krebs.build.host.name}@backup.makefu.r:.";
|
|
|
|
paths = config.state;
|
|
|
|
encryption = {
|
|
|
|
mode = "repokey";
|
|
|
|
passCommand = "cat ${phrase}";
|
|
|
|
};
|
|
|
|
environment.BORG_RSH = "ssh -i ${sshkey}";
|
|
|
|
prune.keep =
|
|
|
|
{ daily = 7;
|
|
|
|
weekly = 4;
|
|
|
|
monthly = -1; # Keep at least one archive for each month
|
|
|
|
};
|
|
|
|
compression = "auto,lzma";
|
|
|
|
startAt = "daily";
|
|
|
|
};
|
|
|
|
}
|