nixos-config/hosts/challenger/backup.nix

48 lines
1.2 KiB
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 _metadata_
transmission = localJob "transmission" [ "/var/lib/transmission" ];
2024-07-04 00:04:40 +02:00
# Calibre metadata and books
calibre = localJob "calibre" [
"/var/lib/calibre-web"
"/var/lib/calibre-server"
"/tank/media/books"
] // {
pruneOpts = [ "--keep-daily 1" ];
};
# Nextcloud data
nextcloud = localJob "nextcloud" [ "/tank/nextcloud" ];
# TODO: timemachine, komga
};
2024-07-04 00:04:40 +02:00
sops.secrets."restic/calibre" = { };
sops.secrets."restic/nextcloud" = { };
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
}