diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-10-31 16:23:05 +0100 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-10-31 16:23:05 +0100 |
| commit | 5c6f5dac44ac25566924f72133c15a70b3b6ba78 (patch) | |
| tree | 3f9ea2d9aec9d452983b2edd8c5317cf73b7d988 /modules/by-name/po | |
| parent | treewide: Align modules with server directory (diff) | |
| download | nixos-config-5c6f5dac44ac25566924f72133c15a70b3b6ba78.zip | |
modules/backup: Simplify and align with server module
Diffstat (limited to 'modules/by-name/po')
| -rw-r--r-- | modules/by-name/po/postgresql/module.nix | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/by-name/po/postgresql/module.nix b/modules/by-name/po/postgresql/module.nix index 319c3ac5..ccc08b37 100644 --- a/modules/by-name/po/postgresql/module.nix +++ b/modules/by-name/po/postgresql/module.nix @@ -1,6 +1,7 @@ { config, lib, + pkgs, ... }: let cfg = config.vhack.postgresql; @@ -14,6 +15,25 @@ in { "/var/lib/postgresql" ]; + vhack.services.backup = { + exclude = [ + "/var/lib/postgresql" # included in the db dump + ]; + + backupPrepare.postgresql = '' + ${lib.getExe pkgs.sudo} -u postgres \ + ${lib.getExe' "pg_dumpall" pkgs.postgresql} \ + --clean \ + --if-exists \ + --quote-all-identifiers | + ${lib.getExe pkgs.xz} \ + --compress \ + -9 \ + --extreme \ + --threads=0 > /srv/db_backup.sql.xz + ''; + }; + services.postgresql.enable = true; }; } |
