feat(rpi4): update restic backup config

This commit is contained in:
Felix Schröter 2021-03-21 15:39:11 +01:00
parent 50753334b4
commit 72a4fb4fbc
No known key found for this signature in database
GPG key ID: 910ACB9F6BD26F58

View file

@ -1,11 +1,39 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ let
services.restic.backups.rpi4 = { resticConfig = args@{ name, extraPruneOpts ? [ ], ... }:
initialize = true; assert !hasAnyAttr [
repository = "b2:felschr-rpi4-backup:/"; "initialize"
s3CredentialsFile = "/etc/nixos/secrets/restic/b2"; "repository"
passwordFile = "/etc/nixos/secrets/restic/password"; "s3CredentialsFile"
"passwordFile"
"pruneOpts"
] args;
args // {
initialize = true;
repository = "b2:felschr-rpi4-backup:/${name}";
s3CredentialsFile = "/etc/nixos/secrets/restic/b2";
passwordFile = "/etc/nixos/secrets/restic/password";
timerConfig = if (args ? timerConfig) then
args.timerConfig
else {
OnCalendar = "daily";
};
pruneOpts = [
"--keep-daily 7"
"--keep-weekly 4"
"--keep-monthly 3"
"--keep-yearly 1"
] ++ extraPruneOpts;
};
in {
services.restic.backups.full = resticConfig {
name = "full";
paths = [ "/home" "/var" "/etc" ];
};
services.restic.backups.data = resticConfig {
name = "data";
paths = [ paths = [
"/etc/nixos" "/etc/nixos"
"/home/felschr/.config/syncthing" "/home/felschr/.config/syncthing"
@ -19,12 +47,6 @@
"/var/lib/owntracks-recorder" "/var/lib/owntracks-recorder"
]; ];
timerConfig = { OnCalendar = "hourly"; }; timerConfig = { OnCalendar = "hourly"; };
pruneOpts = [ extraPruneOpts = [ "--keep-hourly 24" ];
"--keep-hourly 24"
"--keep-daily 7"
"--keep-weekly 4"
"--keep-monthly 3"
"--keep-yearly 1"
];
}; };
} }