nixos-config/hosts/chunk/borg.nix

64 lines
1.5 KiB
Nix
Raw Normal View History

{
pkgs,
config,
...
2024-12-19 02:32:58 -05:00
}:
{
2024-12-15 02:44:50 -05:00
services.borgbackup.jobs = {
crashRsync = {
2024-12-19 02:32:58 -05:00
paths = [
"/root"
"/home"
"/var/backup"
"/var/lib"
"/var/log"
"/opt"
"/etc"
"/vw-data"
];
exclude = [
"**/.cache"
"**/node_modules"
"**/cache"
"**/Cache"
"/var/lib/docker"
"/var/lib/containers/cache"
"/var/lib/containers/overlay*"
];
2024-12-15 02:44:50 -05:00
repo = "de3911@de3911.rsync.net:borg/crash";
encryption = {
mode = "repokey-blake2";
passCommand = "cat ${config.sops.secrets."borg/rsyncnet".path}";
2024-12-15 02:44:50 -05:00
};
environment = {
2024-12-20 18:54:20 -05:00
BORG_RSH = ''ssh -i ${config.sops.secrets."rsyncnet/id_ed25519".path}'';
2024-12-15 02:44:50 -05:00
BORG_REMOTE_PATH = "borg1";
2024-12-20 18:19:18 -05:00
BORG_EXIT_CODES = "modern";
2024-12-15 02:44:50 -05:00
};
compression = "auto,zstd";
startAt = "hourly";
2024-12-20 18:54:20 -05:00
extraCreateArgs = [
"--stats"
"-x"
];
2024-12-15 02:44:50 -05:00
# warnings are often not that serious
failOnWarnings = false;
postHook = ''
2024-12-19 02:32:58 -05:00
${pkgs.curl}/bin/curl -u $(cat ${
config.sops.secrets."services/ntfy".path
}) -d "chunk: backup completed with exit code: $exitStatus
2024-12-15 02:44:50 -05:00
$(journalctl -u borgbackup-job-crashRsync.service|tail -n 5)" \
https://ntfy.cything.io/chunk
'';
2024-12-26 05:26:31 -05:00
prune.keep = {
within = "1d";
2024-12-26 05:43:57 -05:00
daily = 7;
2024-12-26 05:26:31 -05:00
weekly = 4;
monthly = -1;
};
2024-12-26 05:43:57 -05:00
extraPruneArgs = ["--stats"];
2024-12-15 02:44:50 -05:00
};
};
}