diff --git a/modules/backup.nix b/modules/backup.nix index 2ef0b39a..613e2e98 100644 --- a/modules/backup.nix +++ b/modules/backup.nix @@ -9,7 +9,7 @@ compression = "zstd"; compressionLevel = 9; pgdumpOptions = "--create --clean"; - startAt = "*-*-* 06:00:00"; + startAt = "*-*-* 04:00:00"; }; restic.backups = @@ -24,6 +24,10 @@ "--keep-weekly 4" "--keep-monthly 12" ]; + timerConfig = { + OnCalendar = "*-*-* 04:30:00"; + RandomizedDelaySec = "5m"; + }; }; in { @@ -35,6 +39,7 @@ }); }; }; + sops.secrets = { "restic/offsite/private" = { mode = "400"; @@ -63,5 +68,9 @@ ln -fs {,/home}/root/.ssh/id_offsite-backup.pub ln -fs {,/home}/root/.ssh/config ''; + + systemd.timers = lib.mkIf config.services.postgresqlBackup.enable { + postgresqlBackup.timerConfig.RandomizedDelaySec = "5m"; + }; }; }