nixos-config/hosts/challenger/backup.nix

33 lines
835 B
Nix
Raw Normal View History

2024-07-04 00:04:40 +02:00
{ config, pkgs, lib, ... }:
{
services.restic.backups = let
localJob = name: paths: {
inherit paths;
repository = "/mnt/feal-syn1/backup/challenger/${name}";
passwordFile = config.sops.secrets."restic/${name}".path;
initialize = true;
pruneOpts = [
"--keep-daily 7"
"--keep-weekly 4"
"--keep-monthly 3"
"--keep-yearly 10"
];
};
in {
postgres = (localJob "postgres" [ "/var/backup/postgres" ]) // {
timerConfig.OnCalendar = "05:15"; # 2h after postgresqlBackup
};
2024-07-04 00:04:40 +02:00
transmission = localJob "transmission" [ "/var/lib/transmission" ];
2024-07-04 00:04:40 +02:00
# TODO: timemachine, nextcloud, komga, calibre
};
2024-07-04 00:04:40 +02:00
sops.secrets."restic/postgres" = { };
sops.secrets."restic/transmission" = { };
2024-07-04 00:04:40 +02:00
environment.systemPackages = with pkgs; [
restic
];
2024-07-04 00:04:40 +02:00
}