feat: add restic configuration for winters

This commit is contained in:
Leon Schwarzäugl 2025-05-24 18:12:11 +02:00
parent b83c578d63
commit 2a216838ec
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
7 changed files with 233 additions and 110 deletions

View file

@ -1,9 +1,47 @@
{ lib, config, ... }:
{ lib, config, inputs, ... }:
let
secretsDirectory = builtins.toString inputs.nix-secrets;
resticRepo = lib.swarselsystems.getSecret "${secretsDirectory}/restic/wintersRepo";
in
{
options.swarselsystems.modules.server.restic = lib.mkEnableOption "enable restic backups on server";
config = lib.mkIf config.swarselsystems.modules.server.restic {
# TODO
sops = {
secrets = {
resticpw = { };
resticaccesskey = { };
resticsecretaccesskey = { };
};
templates = {
"restic-env".content = ''
AWS_ACCESS_KEY_ID=${config.sops.placeholder.resticaccesskey}
AWS_SECRET_ACCESS_KEY=${config.sops.placeholder.resicsecretaccesskey}
'';
};
};
services.restic = {
backups = {
SwarselWinters = {
environmentFile = config.sops.templates."restic-env".path;
passwordFile = config.sops.secrets.resticpw.path;
paths = [
"/Vault/data/paperless"
"/Vault/Eternor/Paperless"
"/Vault/data/paperless"
"/Vault/Eternor/Bilder"
"/Vault/Eternor/Immich"
];
repository = "${resticRepo}";
initialize = true;
timerConfig = {
OnCalendar = "19:00";
};
};
};
};
};
}