setup hetzner backups

This commit is contained in:
Khaïs COLIN 2025-08-01 11:32:39 +02:00
parent 577043fb71
commit 6a3753a41d
Signed by: logistic-bot
SSH key fingerprint: SHA256:3zI3/tx0ZpCLHCLPmEaGR4oeYCPMCzQxXhXutBmtOAU

View file

@ -105,6 +105,45 @@
Requires = "external.mount";
};
};
services.borgbackup.jobs."hetzner" = {
paths = [
"/home"
"/var"
"/pile"
];
exclude = [
"/home/*/.local/share/Steam"
"**/*cache"
"**/*Cache"
"**/*trash"
"**/*Trash"
"/home/*/.mozilla/firefox"
"/home/*/GOG Games"
"**/target"
"**/result"
"/var/log"
];
repo = "ssh://u480566-sub1@u480566-sub1.your-storagebox.de:23/./repo";
encryption = {
mode = "repokey-blake2";
passCommand = "cat /root/borgbackup/hetzner_passphrase";
};
environment.BORG_RSH = "ssh -i /root/borgbackup/hetzner_ssh_key";
compression = "auto,lzma";
startAt = "daily";
persistentTimer = true;
extraCreateArgs = ["--stats" "--info" "--list" "--filter" "AMEC"];
extraPruneArgs = ["--stats" "--info" "--list"];
prune.keep = {
within = "1d";
daily = 7;
weekly = 4;
monthly = 12;
};
preHook = ''
/bin/sh -c 'while ! /run/current-system/sw/bin/ping -c1 google.com; do sleep 1; done'
'';
};
# postgresql backup
services.postgresqlBackup = {