flake/nixos/profiles/restic/default.nix
2024-09-22 16:39:01 +08:00

27 lines
739 B
Nix

{ config, ... }:
{
sops.secrets = builtins.mapAttrs (_n: v: v // { sopsFile = ./secrets.yaml; }) {
"restic/environment" = { };
"restic/password" = { };
"restic/repository" = { };
};
services.restic.backups.persist = {
environmentFile = config.sops.secrets."restic/environment".path;
passwordFile = config.sops.secrets."restic/password".path;
repositoryFile = config.sops.secrets."restic/repository".path;
paths = [ "/persist" ];
extraBackupArgs = [
"--one-file-system"
"--exclude-caches"
"--no-scan"
"--retry-lock 2h"
];
timerConfig = {
OnCalendar = "daily";
RandomizedDelaySec = "4h";
FixedRandomDelay = true;
Persistent = true;
};
};
}