Add restic backups to lebesgue.

This commit is contained in:
Lorenzo Good 2025-02-06 17:44:13 -06:00
parent 3917e40b53
commit 6b3755ca06
Signed by: lorenzo
GPG key ID: 7FCD64BD81180ED0
4 changed files with 49 additions and 2 deletions

View file

@ -0,0 +1,40 @@
{
pkgs,
config,
...
}: let
paths = ["/var/lib/vaultwarden"];
exclude = [];
secrets = config.sops.secrets;
in {
users.groups.restic = {};
users.users.restic = {
isSystemUser = true;
group = "restic";
};
security.wrappers.restic = {
source = "${pkgs.restic.out}/bin/restic";
owner = "restic";
group = "restic";
permissions = "u=rwx,g=,o=";
capabilities = "cap_dac_read_search=+ep";
};
services.restic.backups = {
s3 = {
inherit paths exclude;
user = "restic";
repositoryFile = secrets.restic-repository.path;
environmentFile = secrets.restic-env.path;
passwordFile = secrets.restic-password.path;
pruneOpts = [
"--keep-daily 7"
"--keep-weekly 4"
];
};
};
}

View file

@ -6,6 +6,9 @@
admin-password.neededForUsers = true;
tskey = {};
vaultwarden-env = {};
restic-env = {owner = "restic";};
restic-password = {owner = "restic";};
restic-repository = {owner = "restic";};
};
};
}

View file

@ -3,6 +3,7 @@
environment.persistence."/persist" = {
directories = [
"/var/cache/restic-backups-s3"
"/var/lib/tailscale"
"/var/log"
"/var/lib/nixos"