add backups for NAS

This commit is contained in:
2024-11-18 19:21:50 +01:00
parent 13925c6490
commit ab27ee081a
2 changed files with 31 additions and 3 deletions

View File

@ -35,6 +35,9 @@ in {
sops.secrets."tailscale-auth-key" = {};
sops.secrets."act-runner-token" = {};
sops.secrets."photoprism-password-file" = {};
sops.secrets."restic_ssh_key" = {};
sops.secrets."restic_documents_repository_password" = {};
sops.secrets."restic_images_repository_password" = {};
imports = [
./hardware-configuration.nix
@ -209,6 +212,28 @@ in {
};
};
restic = let
mkBackup = repo: paths: exclude: {
repository = "sftp:u169497-sub5@u169497.your-storagebox.de:${repo}";
passwordFile = config.sops.secrets."restic_${repo}_repository_password".path;
initialize = true;
extraOptions = [
"sftp.command='ssh -p23 u169497-sub5@u169497.your-storagebox.de -i ${config.sops.secrets."restic_ssh_key".path} -s sftp'"
];
paths = paths;
exclude = exclude;
timerConfig = {
OnCalendar = "00:05";
RandomizedDelaySec = "1h";
};
};
in {
backups = {
documents = mkBackup "documents" ["/tank/documents"] [];
images = mkBackup "images" ["/tank/images"] ["/tank/images/import"];
};
};
nginx = {
enable = true;
clientMaxBodySize = "500m";