nixos-config/hosts/challenger/backup.nix

33 lines
835 B
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 = localJob "transmission" [ "/var/lib/transmission" ];
# TODO: timemachine, nextcloud, komga, calibre
};
sops.secrets."restic/postgres" = { };
sops.secrets."restic/transmission" = { };
environment.systemPackages = with pkgs; [
restic
];
}