nixfiles/hosts/hetzner-vm/containers/piped-fi/profiles/restic.nix

39 lines
826 B
Nix
Raw Normal View History

2023-08-01 22:06:30 +01:00
{
pkgs,
2023-09-19 17:53:44 +01:00
config,
2023-08-01 22:06:30 +01:00
...
}: let
2023-09-19 17:53:44 +01:00
secrets = config.services.secrets.secrets;
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-19 17:53:44 +01:00
RESTIC_PASSWORD_FILE=${secrets.restic_password.path} \
$(cat ${secrets.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
];
2023-09-18 03:56:58 +01:00
repository = "rest:https://storage-restic.owo.monster/Piped-Finland";
2023-09-19 17:53:44 +01:00
passwordFile = "${secrets.restic_password.path}";
environmentFile = "${secrets.restic_env.path}";
2023-08-01 22:06:30 +01:00
pruneOpts = [
"--keep-last 5"
];
timerConfig = {
OnBootSec = "1m";
OnCalendar = "daily";
};
};
}