Add restic backups to lebesgue.
This commit is contained in:
parent
3917e40b53
commit
6b3755ca06
4 changed files with 49 additions and 2 deletions
40
machines/lebesgue/config/backups.nix
Normal file
40
machines/lebesgue/config/backups.nix
Normal 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"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -6,6 +6,9 @@
|
|||
admin-password.neededForUsers = true;
|
||||
tskey = {};
|
||||
vaultwarden-env = {};
|
||||
restic-env = {owner = "restic";};
|
||||
restic-password = {owner = "restic";};
|
||||
restic-repository = {owner = "restic";};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
environment.persistence."/persist" = {
|
||||
directories = [
|
||||
"/var/cache/restic-backups-s3"
|
||||
"/var/lib/tailscale"
|
||||
"/var/log"
|
||||
"/var/lib/nixos"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue