dotfiles/nixos/boxes/vpsfree1/backups.nix

28 lines
816 B
Nix

{ config, pkgs, ... }: rec {
environment.systemPackages = with pkgs; [ restic ];
sops.secrets."restic-backups-b2-repo-password" = {
sopsFile = ./restic.sops.yaml;
};
sops.secrets."restic-backups-b2-environment" = {
sopsFile = ./restic-environment.sops;
format = "binary";
path = "/etc/nixos/secrets/b2-env";
};
services = {
restic.backups.b2 = {
passwordFile = "/run/secrets/restic-backups-b2-repo-password";
paths = [ "/var/lib/foundryvtt" "/var/lib/gitea" ];
repository = "b2:cyplo-restic-vpsfree";
timerConfig = { OnCalendar = "hourly"; };
environmentFile =
"${config.sops.secrets.restic-backups-b2-environment.path}";
};
};
systemd.services.restic-backups-b2.serviceConfig = {
Nice = 19;
IOSchedulingClass = "idle";
};
}