diff --git a/helpers/services.nix b/helpers/services.nix index 2e735e7..46f160b 100644 --- a/helpers/services.nix +++ b/helpers/services.nix @@ -133,7 +133,11 @@ in { dump = site.backup.database; paths = builtins.concatLists [ site.backup.paths - (if dump != null then [ "/var/backup/${key}.sql" ] else []) + ( + if dump != null + then ["/var/backup/${key}.sql"] + else [] + ) ]; preHook = lib.mkIf (dump != null) '' mkdir -p /var/backup @@ -144,35 +148,38 @@ in { ''; in if site.backup.enable - then acc // { - "${key}" = { - repo = backup_cfg.borgRepository + "/./${key}"; - environment = { - BORG_RSH = "ssh -i ${backup_cfg.borgSSHKey} -o 'StrictHostKeyChecking=no'"; + then + acc + // { + "${key}" = { + repo = backup_cfg.borgRepository + "/./${key}"; + environment = { + BORG_RSH = "ssh -i ${backup_cfg.borgSSHKey} -o 'StrictHostKeyChecking=no'"; + }; + inherit paths; + encryption = { + mode = "keyfile"; + passCommand = backup_cfg.borgPassCommand; + }; + compression = "auto,lzma"; + startAt = "daily"; + prune.keep = { + daily = 7; + weekly = 4; + monthly = -1; + }; + inherit preHook; + inherit postHook; }; - inherit paths; - encryption = { - mode = "keyfile"; - passCommand = backup_cfg.borgPassCommand; - }; - compression = "auto,lzma"; - startAt = "daily"; - prune.keep = { - daily = 7; - weekly = 4; - monthly = -1; - }; - inherit preHook; - inherit postHook; - }; - } else acc) {} (builtins.attrNames cfg); + } + else acc) {} (builtins.attrNames cfg); - systemd.tmpfiles.settings = { - "99-borgdatabasebackups"."/var/backup/postgres".d = { - user = "root"; - group = "root"; - mode = "0755"; - }; + systemd.tmpfiles.settings = { + "99-borgdatabasebackups"."/var/backup/postgres".d = { + user = "root"; + group = "root"; + mode = "0755"; }; + }; }; -} \ No newline at end of file +}