From 416410579aae54cc83f39c609f8bec7e3584d5d3 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Fri, 10 Jun 2022 19:35:44 -0400 Subject: [PATCH] lets try that again --- machines/oracles.nix | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/machines/oracles.nix b/machines/oracles.nix index c51e0cf..09dd6b0 100644 --- a/machines/oracles.nix +++ b/machines/oracles.nix @@ -88,23 +88,31 @@ monthly = -1; # Keep unlimited monthly backups }; }; - postgres = { - dumpCommand = "su postgres -c pg_dumpall"; - repo = "de1955@de1955.rsync.net:databases/oracles/postgres"; - encryption = { - mode = "repokey-blake2"; - passCommand = "cat ${config.sops.secrets."borg-oraclesPassword".path}"; + postgres = + let dumper = pkgs.writeScript "pg-dumper" + '' + #!/usr/bin/env bash + su -c postgres pg_dumpall + ''; + in + { + + dumpCommand = dumper; + repo = "de1955@de1955.rsync.net:databases/oracles/postgres"; + encryption = { + mode = "repokey-blake2"; + passCommand = "cat ${config.sops.secrets."borg-oraclesPassword".path}"; + }; + environment.BORG_RSH = "ssh -i ${config.sops.secrets."borg-sshKey".path}"; + compression = "auto,zstd"; + startAt = "hourly"; + prune.keep = { + within = "7d"; # Keep all archives for the past week + daily = 1; # Keep 1 snapshot a day for 2 weeks + weekly = 4; # Keep 1 snapshot a week for 4 weeks + monthly = -1; # Keep unlimited monthly backups + }; }; - environment.BORG_RSH = "ssh -i ${config.sops.secrets."borg-sshKey".path}"; - compression = "auto,zstd"; - startAt = "hourly"; - prune.keep = { - within = "7d"; # Keep all archives for the past week - daily = 1; # Keep 1 snapshot a day for 2 weeks - weekly = 4; # Keep 1 snapshot a week for 4 weeks - monthly = -1; # Keep unlimited monthly backups - }; - }; }; }