From f04ca9d1de5a889c3c8e186c350d0277ab8003c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Sat, 3 Dec 2022 08:25:47 +0100 Subject: [PATCH] feat(postgresql): enable backup --- systems/makanek/configuration.nix | 2 +- systems/makanek/nextcloud.nix | 9 +++++++-- systems/makanek/tt-rss.nix | 6 ++++++ systems/zaatar/atuin.nix | 5 +++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/systems/makanek/configuration.nix b/systems/makanek/configuration.nix index 32d3bbb..aa65e5e 100644 --- a/systems/makanek/configuration.nix +++ b/systems/makanek/configuration.nix @@ -43,7 +43,7 @@ in { passwordFile = toString ; paths = [ "/var/lib/codimd" - "/var/lib/postgresql" + config.services.postgresqlBackup.location "/var/lib/weechat" "/var/lib/nextcloud" "/var/lib/grafana" diff --git a/systems/makanek/nextcloud.nix b/systems/makanek/nextcloud.nix index 85370c2..8f7196b 100644 --- a/systems/makanek/nextcloud.nix +++ b/systems/makanek/nextcloud.nix @@ -65,13 +65,18 @@ in { } ]; + services.postgresqlBackup = { + enable = true; + databases = [config.services.nextcloud.config.dbname]; + }; + services.postgresql = { enable = true; - ensureDatabases = ["nextcloud"]; + ensureDatabases = [config.services.nextcloud.config.dbname]; ensureUsers = [ { name = "nextcloud"; - ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES"; + ensurePermissions."DATABASE ${config.services.nextcloud.config.dbname}" = "ALL PRIVILEGES"; } ]; }; diff --git a/systems/makanek/tt-rss.nix b/systems/makanek/tt-rss.nix index c0e18b0..7568190 100644 --- a/systems/makanek/tt-rss.nix +++ b/systems/makanek/tt-rss.nix @@ -1,6 +1,7 @@ { pkgs, lib, + config, ... }: let domain = "feed.kmein.de"; @@ -17,6 +18,11 @@ in { }; }; + services.postgresqlBackup = { + enable = true; + databases = [config.services.tt-rss.database.name]; + }; + services.nginx.virtualHosts.${domain} = { enableACME = true; forceSSL = true; diff --git a/systems/zaatar/atuin.nix b/systems/zaatar/atuin.nix index acae725..7772e81 100644 --- a/systems/zaatar/atuin.nix +++ b/systems/zaatar/atuin.nix @@ -14,6 +14,11 @@ in { ]; }; + services.postgresqlBackup = { + enable = true; + databases = ["atuin"]; + }; + systemd.tmpfiles.rules = [ (tmpfilesConfig { type = "d";