diff options
Diffstat (limited to 'modules/by-name/po/postgresql/module.nix')
| -rw-r--r-- | modules/by-name/po/postgresql/module.nix | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/modules/by-name/po/postgresql/module.nix b/modules/by-name/po/postgresql/module.nix index 5cdf6c77..ccc08b37 100644 --- a/modules/by-name/po/postgresql/module.nix +++ b/modules/by-name/po/postgresql/module.nix @@ -1,30 +1,39 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, + pkgs, ... }: let - cfg = config.soispha.services.postgresql; + cfg = config.vhack.postgresql; in { - options.soispha.services.postgresql = { + options.vhack.postgresql = { enable = lib.mkEnableOption "postgresql"; }; config = lib.mkIf cfg.enable { - soispha.impermanence.directories = [ + vhack.persist.directories = [ "/var/lib/postgresql" ]; - services.postgresql = { - enable = true; + 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; }; } |
