use backup module on chunk
This commit is contained in:
parent
f23cc43287
commit
b5f231ac01
3 changed files with 21 additions and 65 deletions
20
hosts/chunk/backup.nix
Normal file
20
hosts/chunk/backup.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
my.backup = {
|
||||
enable = true;
|
||||
jobName = "crashRsync";
|
||||
paths = [
|
||||
"/vw-data"
|
||||
];
|
||||
exclude = [
|
||||
# podman stuff
|
||||
"/var/lib/containers"
|
||||
];
|
||||
repo = "crash";
|
||||
passFile = config.sops.secrets."borg/rsyncnet".path;
|
||||
sshKeyFile = config.sops.secrets."rsyncnet/id_ed25519".path;
|
||||
};
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
{
|
||||
services.borgbackup.jobs.crashRsync = {
|
||||
# systemd.timer(5)
|
||||
persistentTimer = true;
|
||||
paths = [
|
||||
"/root"
|
||||
"/home"
|
||||
"/var/backup"
|
||||
"/var/lib"
|
||||
"/opt"
|
||||
"/etc"
|
||||
"/vw-data"
|
||||
];
|
||||
exclude = [
|
||||
"**/.cache"
|
||||
"**/node_modules"
|
||||
"**/cache"
|
||||
"**/Cache"
|
||||
"/var/lib/docker"
|
||||
"/var/lib/containers/cache"
|
||||
"/var/lib/containers/overlay*"
|
||||
"/var/lib/systemd"
|
||||
"**/.rustup"
|
||||
"**/.cargo"
|
||||
"**/.docker"
|
||||
];
|
||||
repo = "de3911@de3911.rsync.net:borg/crash";
|
||||
encryption = {
|
||||
mode = "repokey-blake2";
|
||||
passCommand = "cat ${config.sops.secrets."borg/rsyncnet".path}";
|
||||
};
|
||||
environment = {
|
||||
BORG_RSH = ''ssh -i ${config.sops.secrets."rsyncnet/id_ed25519".path}'';
|
||||
BORG_REMOTE_PATH = "borg1";
|
||||
BORG_EXIT_CODES = "modern";
|
||||
};
|
||||
compression = "auto,zstd,8";
|
||||
startAt = "hourly";
|
||||
extraCreateArgs = [
|
||||
"--stats"
|
||||
"-x"
|
||||
];
|
||||
# warnings are often not that serious
|
||||
failOnWarnings = false;
|
||||
postHook = ''
|
||||
${pkgs.curl}/bin/curl -O /dev/null -u $(cat ${
|
||||
config.sops.secrets."services/ntfy".path
|
||||
}) -d "chunk: backup completed with exit code: $exitStatus
|
||||
$(journalctl --output-fields=MESSAGE -o cat -qu borgbackup-job-crashRsync.service |tail -n 10)
|
||||
" https://ntfy.cything.io/ytnix
|
||||
'';
|
||||
|
||||
prune.keep = {
|
||||
within = "2d";
|
||||
daily = 365;
|
||||
};
|
||||
extraPruneArgs = [ "--stats" ];
|
||||
};
|
||||
}
|
|
@ -11,7 +11,7 @@
|
|||
../yt.nix
|
||||
./hardware-configuration.nix
|
||||
./gitlab.nix
|
||||
./borg.nix
|
||||
./backup.nix
|
||||
./rclone.nix
|
||||
./postgres.nix
|
||||
./wireguard.nix
|
||||
|
|
Loading…
Add table
Reference in a new issue