From a5ec39cd2a358107e6b2e89fcd36566363f68d34 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sun, 25 Feb 2024 21:14:04 +0000 Subject: [PATCH] map users to generic postgres roles --- modules/nixos/services/postgresql.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/nixos/services/postgresql.nix b/modules/nixos/services/postgresql.nix index b1a367a..1784ea3 100644 --- a/modules/nixos/services/postgresql.nix +++ b/modules/nixos/services/postgresql.nix @@ -3,9 +3,17 @@ services.postgresql = { package = pkgs.postgresql_15; settings = { }; - identMap = ""; + authentication = '' + local all postgres peer map=root + local all admin peer map=admin + ''; + identMap = '' + root postgres postgres + root root postgres + admin ${config.user} admin + ''; ensureUsers = [{ - name = config.user; + name = "admin"; ensureClauses = { createdb = true; createrole = true;