move hosts

This commit is contained in:
root 2025-11-09 00:05:37 +00:00
parent f8651a6cf1
commit ec4f066396
18 changed files with 181 additions and 229 deletions

View file

@ -140,9 +140,10 @@ in {
else []
)
];
readWritePaths = lib.mkIf (dump != null) [ "/var/backup/postgres/" ];
preHook = lib.mkIf (dump != null) ''
mkdir -p /var/backup
${pkgs.sudo}/bin/sudo -u postgres pg_dump ${dump} > /var/backup/postgres/${key}.sql
mkdir -p /var/backup/postgres
${pkgs.sudo}/bin/sudo -u postgres ${pkgs.postgresql}/bin/pg_dump ${dump} > /var/backup/postgres/${key}.sql
'';
postHook = lib.mkIf (dump != null) ''
rm -f /var/backup/postgres/${key}.sql
@ -153,7 +154,7 @@ in {
acc
// {
"${key}" = {
repo = backup_cfg.borgRepository + "/./${key}";
repo = lib.strings.concatStrings [backup_cfg.borgRepository "/./${key}"];
environment = {
BORG_RSH = "ssh -i ${backup_cfg.borgSSHKey} -o 'StrictHostKeyChecking=no'";
};
@ -169,6 +170,7 @@ in {
weekly = 4;
monthly = -1;
};
inherit readWritePaths;
inherit preHook;
inherit postHook;
};