2024-07-04 00:04:40 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
{
|
2024-10-04 21:37:14 +02:00
|
|
|
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
|
|
|
|
2024-10-05 21:44:41 +02:00
|
|
|
# Transmission _metadata_
|
2024-10-04 21:37:14 +02:00
|
|
|
transmission = localJob "transmission" [ "/var/lib/transmission" ];
|
2024-07-04 00:04:40 +02:00
|
|
|
|
2024-10-05 21:44:41 +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-10-04 21:37:14 +02:00
|
|
|
};
|
2024-07-04 00:04:40 +02:00
|
|
|
|
2024-10-05 21:44:41 +02:00
|
|
|
sops.secrets."restic/calibre" = { };
|
|
|
|
sops.secrets."restic/nextcloud" = { };
|
2024-10-04 21:37:14 +02:00
|
|
|
sops.secrets."restic/postgres" = { };
|
|
|
|
sops.secrets."restic/transmission" = { };
|
2024-07-04 00:04:40 +02:00
|
|
|
|
2024-10-04 21:37:14 +02:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
restic
|
|
|
|
];
|
2024-07-04 00:04:40 +02:00
|
|
|
}
|