2023-08-01 22:06:30 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
2023-09-18 03:56:58 +01:00
|
|
|
hostSecrets,
|
2023-08-01 22:06:30 +01:00
|
|
|
...
|
|
|
|
}: let
|
2023-09-18 03:56:58 +01:00
|
|
|
secrets = hostSecrets;
|
2023-08-01 22:06:30 +01:00
|
|
|
in {
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
restic
|
2023-09-18 03:56:58 +01:00
|
|
|
(pkgs.writeShellScriptBin "restic-piped-finland" ''
|
2023-08-01 22:06:30 +01:00
|
|
|
env \
|
2023-09-18 03:56:58 +01:00
|
|
|
RESTIC_PASSWORD_FILE=${secrets.piped_finland_restic_password.path} \
|
|
|
|
$(cat ${secrets.piped_finland_restic_env.path}) \
|
2023-08-01 22:06:30 +01:00
|
|
|
${pkgs.restic}/bin/restic $@
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
2023-09-18 03:56:58 +01:00
|
|
|
services.restic.backups.piped-finland = {
|
2023-08-01 22:06:30 +01:00
|
|
|
user = "root";
|
|
|
|
paths = [
|
2023-09-18 03:56:58 +01:00
|
|
|
"/var/lib/cockroachdb"
|
|
|
|
"/var/lib/cockroachdb-certs"
|
2023-08-01 22:06:30 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
# repository is overrided in environmentFile to contain auth
|
|
|
|
# make sure to keep up to date when changing repository
|
2023-09-18 03:56:58 +01:00
|
|
|
repository = "rest:https://storage-restic.owo.monster/Piped-Finland";
|
|
|
|
passwordFile = "${secrets.piped_finland_restic_password.path}";
|
|
|
|
environmentFile = "${secrets.piped_finland_restic_env.path}";
|
2023-08-01 22:06:30 +01:00
|
|
|
|
|
|
|
pruneOpts = [
|
|
|
|
"--keep-last 5"
|
|
|
|
];
|
|
|
|
|
|
|
|
timerConfig = {
|
|
|
|
OnBootSec = "1m";
|
|
|
|
OnCalendar = "daily";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|