boxen/hosts/gwydion/backup.nix

49 lines
1.1 KiB
Nix

{ config, lib, pkgs, ... }:
let
h = config.users.users.jez.home;
repoRoot = "ssh://u275275@u275275.your-storagebox.de:23/./borg";
defaults = {
user = "jez";
compression = "auto,zstd";
startAt = "hourly";
encryption = {
mode = "keyfile";
passCommand = "cat ${h}/Private/Keys/Borg/passphrase";
};
extraInitArgs = "--make-parent-dirs";
environment = {
BORG_RSH = "ssh -i /home/jez/.ssh/id_rsa_u275275";
BORG_KEYS_DIR = "${h}/Private/Keys/Borg/keyfiles";
};
};
in {
services.borgbackup.jobs = {
general = lib.recursiveUpdate defaults {
paths = [
"${h}/Documents"
"${h}/Projects"
"${h}/Reference"
"${h}/Notes"
"${h}/Web"
"/etc/nixos"
];
repo = "${repoRoot}/Gwydion/General";
exclude = [ "target" ".build" ".sync" ".stfolder" ];
prune.keep = {
within = "1w";
daily = 14;
weekly = 4;
monthly = -1;
};
};
mail = lib.recursiveUpdate defaults {
paths = [ "${h}/Maildir" "${h}/Archive" ];
repo = "${repoRoot}/Gwydion/Mail";
prune.keep.daily = 3;
};
};
}