feat(backup): backup server to borgbase daily

This commit is contained in:
Khaïs COLIN 2024-08-24 16:26:18 +00:00
parent 4d4249f627
commit 7e714fe3e2
2 changed files with 31 additions and 0 deletions

30
borgbackup.nix Normal file
View file

@ -0,0 +1,30 @@
{
services.borgbackup.jobs."borgbase" = {
paths = [
"/var/backup"
"/var/lib/sourcehut"
"/etc/nixos"
"/root"
"/home"
];
exclude = [
"**/*cache"
"**/*Cache"
"**/*trash"
"**/*Trash"
"/home/*/.local"
"**/target"
"**/result"
];
repo = "foy40rzb@foy40rzb.repo.borgbase.com:repo";
encryption = {
mode = "repokey-blake2";
passCommand = "cat /root/borgbackup/passphrase";
};
environment.BORG_RSH = "ssh -i /root/borgbackup/ssh_key";
compression = "auto,lzma";
startAt = "daily";
# also start if the starttime was missed
persistentTimer = true;
};
}

View file

@ -6,6 +6,7 @@ in
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
./firewall.nix ./firewall.nix
./borgbackup.nix
(import ./acme.nix { inherit base-domain; }) (import ./acme.nix { inherit base-domain; })
(import ./nginx.nix { inherit base-domain; }) (import ./nginx.nix { inherit base-domain; })