feat: enable restic backup service for vaultwarden and paperless

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
This commit is contained in:
Chinmay D. Pai 2024-09-30 01:17:54 +05:30
parent 6aefe6d33b
commit 40d4792bc8
Signed by: thunderbottom
GPG Key ID: 75507BE256F40CED
6 changed files with 33 additions and 7 deletions

View File

@ -16,6 +16,10 @@
}; };
}; };
services = { services = {
backups = {
environment.file = ./secrets/services/backups/environment.age;
password.file = ./secrets/services/backups/password.age;
};
gitea = { gitea = {
password.file = ./secrets/services/gitea/password.age; password.file = ./secrets/services/gitea/password.age;
}; };

View File

@ -63,5 +63,15 @@
}; };
}; };
}; };
snowflake.services.backups.paperless.config = {
dynamicFilesFrom = let
path = config.services.paperless.dataDir;
in ''
mkdir -p ${path}/exported
${path}/paperless-manage document_exporter ${path}/exported
echo ${path}/exported/
'';
};
}; };
} }

View File

@ -3,8 +3,7 @@
lib, lib,
pkgs, pkgs,
... ...
}: }: {
{
options.snowflake.services.vaultwarden = { options.snowflake.services.vaultwarden = {
enable = lib.mkEnableOption "Enable vaultwarden service with postgres and nginx"; enable = lib.mkEnableOption "Enable vaultwarden service with postgres and nginx";
@ -19,8 +18,10 @@
}; };
}; };
config = # TODO: when upgrading stateVersion to 24.11, the data directory will
let # change from /var/lib/bitwarden_rs to /var/lib/vaultwarden.
# We need to move the data and then change the backup service directory.
config = let
cfg = config.snowflake.services.vaultwarden; cfg = config.snowflake.services.vaultwarden;
in in
lib.mkIf cfg.enable { lib.mkIf cfg.enable {
@ -75,5 +76,9 @@
}; };
}; };
}; };
snowflake.services.backups.vaultwarden.paths = [
"/var/lib/bitwarden_rs"
];
}; };
} }

View File

@ -121,6 +121,13 @@
services = { services = {
arr.enable = true; arr.enable = true;
backups = {
enable = true;
repository = "b2:restic-nix";
resticPasswordFile = userdata.secrets.services.backups.password;
resticEnvironmentFile = userdata.secrets.services.backups.environment;
};
gitea = { gitea = {
enable = true; enable = true;
domain = "git.deku.moe"; domain = "git.deku.moe";