nix/borgbackup.nix

55 lines
1.4 KiB
Nix

{
services.borgbackup.jobs."borgbase" = {
paths = [
# server storage
"/var/lib/postgresql"
"/var/lib/mysql"
"/var/lib/sourcehut"
"/var/lib/snipe-it"
# user storage
"/home"
];
exclude = [
# remote mounted folders
"/home/khais/Music"
"/home/khais/Books"
"/home/khais/Audiobooks"
# scratch directories
"/home/*/Downloads"
"/home/*/.local"
# cache & trash directories
"**/*cache"
"**/*Cache"
"**/*trash"
"**/*Trash"
# already cloud apps
"**/.mozilla/firefox"
"**/.thunderbird"
# build-output directories
"**/target"
"**/result"
# too big
"/home/*/GOG Games"
];
repo = "lni0x30f@lni0x30f.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";
persistentTimer = true;
preHook = ''
/bin/sh -c 'while ! /run/current-system/sw/bin/ping -c1 google.com; do sleep 1; done'
'';
extraCreateArgs = ["--stats" "--info" "--list" "--filter" "AMEC"];
extraPruneArgs = ["--stats" "--info" "--list"];
prune.keep = {
within = "1d";
daily = 7;
weekly = 2;
monthly = 3;
};
};
}