about summary refs log tree commit diff
path: root/nixos/modules/services/mail/roundcube.nix
diff options
context:
space:
mode:
authorRyan Lahfa <masterancpp@gmail.com>2023-11-17 18:02:17 +0100
committerGitHub <noreply@github.com>2023-11-17 18:02:17 +0100
commitccfe07c3168109567b98462533f7ddf14c7ba18d (patch)
tree5519b30e969dfbacf48caa51505b3eb49213b290 /nixos/modules/services/mail/roundcube.nix
parentbea932e00a092efe7be61f7bcbebf4a18241a07b (diff)
parent82037ad0b89db3d392c49c1fdbc6b325da5586b1 (diff)
downloadnixlib-ccfe07c3168109567b98462533f7ddf14c7ba18d.tar
nixlib-ccfe07c3168109567b98462533f7ddf14c7ba18d.tar.gz
nixlib-ccfe07c3168109567b98462533f7ddf14c7ba18d.tar.bz2
nixlib-ccfe07c3168109567b98462533f7ddf14c7ba18d.tar.lz
nixlib-ccfe07c3168109567b98462533f7ddf14c7ba18d.tar.xz
nixlib-ccfe07c3168109567b98462533f7ddf14c7ba18d.tar.zst
nixlib-ccfe07c3168109567b98462533f7ddf14c7ba18d.zip
Merge pull request #266270 from Ma27/postgresql-ownership-15
Diffstat (limited to 'nixos/modules/services/mail/roundcube.nix')
-rw-r--r--nixos/modules/services/mail/roundcube.nix14
1 files changed, 11 insertions, 3 deletions
diff --git a/nixos/modules/services/mail/roundcube.nix b/nixos/modules/services/mail/roundcube.nix
index 22a4e3c451ab..4e29f567ed92 100644
--- a/nixos/modules/services/mail/roundcube.nix
+++ b/nixos/modules/services/mail/roundcube.nix
@@ -179,14 +179,22 @@ in
       };
     };
 
+    assertions = [
+      {
+        assertion = localDB -> cfg.database.username == cfg.database.dbname;
+        message = ''
+          When setting up a DB and its owner user, the owner and the DB name must be
+          equal!
+        '';
+      }
+    ];
+
     services.postgresql = mkIf localDB {
       enable = true;
       ensureDatabases = [ cfg.database.dbname ];
       ensureUsers = [ {
         name = cfg.database.username;
-        ensurePermissions = {
-          "DATABASE ${cfg.database.username}" = "ALL PRIVILEGES";
-        };
+        ensureDBOwnership = true;
       } ];
     };