{ self, pkgs, config, ... }: let inherit (config.services.secrets) secrets; backupSchedules = import "${self}/data/backupSchedules.nix"; backupPrepareCommand = "${ (pkgs.writeShellScriptBin "backupPrepareCommand" '' systemctl start remotePostgreSQLBackup-gotosocial --wait '') }/bin/backupPrepareCommand"; in { services.restic.backups.postgresql = { user = "root"; paths = [ "/var/backup/postgresql" ]; repository = "s3:s3.eu-central-003.backblazeb2.com/Chaos-Backups/Restic/PostgreSQL"; passwordFile = "${secrets.restic_password.path}"; environmentFile = "${secrets.restic_env.path}"; createWrapper = true; pruneOpts = ["--keep-last 10"]; timerConfig = backupSchedules.restic.high; inherit backupPrepareCommand; }; services.postgreSQLRemoteBackup = { enable = true; backupUser = "postgres"; databases = [ "gotosocial" ]; }; }