nixfiles/hosts/hetzner-arm/containers/caldav/profiles/restic.nix

36 lines
919 B
Nix
Raw Normal View History

{
2024-03-09 22:18:26 +00:00
self,
pkgs,
config,
...
}: let
2024-03-09 22:18:26 +00:00
backupSchedules = import "${self}/data/backupSchedules.nix";
secrets = config.services.secrets.secrets;
in {
environment.systemPackages = with pkgs; [
restic
(pkgs.writeShellScriptBin "restic-caldav" ''
env \
RESTIC_PASSWORD_FILE=${secrets.restic_password.path} \
$(cat ${secrets.restic_env.path}) \
${pkgs.restic}/bin/restic $@
'')
];
services.restic.backups.caldav = {
user = "root";
paths = [
"/var/lib/radicale"
];
# repository is overrided in environmentFile to contain auth
# make sure to keep up to date when changing repository
repository = "rest:https://storage-restic.owo.monster/CalDAV";
passwordFile = "${secrets.restic_password.path}";
environmentFile = "${secrets.restic_env.path}";
2024-03-09 22:18:26 +00:00
pruneOpts = ["--keep-last 50"];
timerConfig = backupSchedules.restic.high;
};
}