48 lines
1.2 KiB
Nix
48 lines
1.2 KiB
Nix
{ 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
|
|
};
|
|
|
|
# Transmission _metadata_
|
|
transmission = localJob "transmission" [ "/var/lib/transmission" ];
|
|
|
|
# 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
|
|
};
|
|
|
|
sops.secrets."restic/calibre" = { };
|
|
sops.secrets."restic/nextcloud" = { };
|
|
sops.secrets."restic/postgres" = { };
|
|
sops.secrets."restic/transmission" = { };
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
restic
|
|
];
|
|
}
|