From 6cb1e31986290f307892cb36601e0e380ad546ac Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Tue, 4 Mar 2025 21:06:31 +0100 Subject: [PATCH] postgresql/module.nix: add postgres user with permissions --- modules/services/postgresql/module.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/services/postgresql/module.nix b/modules/services/postgresql/module.nix index f5d47a9..abc32fb 100644 --- a/modules/services/postgresql/module.nix +++ b/modules/services/postgresql/module.nix @@ -6,7 +6,7 @@ }: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; - cfg = config.modules.sytem.services.database.postgresql; + cfg = config.modules.system.services.database.postgresql; in { options.modules.system.services.database.postgresql.enable = mkEnableOption "postgresql"; @@ -28,6 +28,16 @@ in { ]; ensureUsers = [ + { + name = "postgres"; + ensureClauses = { + superuser = true; + login = true; + createrole = true; + createdb = true; + replication = true; + }; + } { name = "git"; ensureDBOwnership = true; @@ -35,7 +45,7 @@ in { ]; settings = { # taken from https://pgconfigurator.cybertec.at/ - + # Connectivity max_connections = 100; superuser_reserved_connections = 3;