about summary refs log tree commit diff
path: root/nixos/modules/services/mail/sympa.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/sympa.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/sympa.nix')
-rw-r--r--nixos/modules/services/mail/sympa.nix10
1 files changed, 4 insertions, 6 deletions
diff --git a/nixos/modules/services/mail/sympa.nix b/nixos/modules/services/mail/sympa.nix
index 7a5047b2bea5..04ae46f66eea 100644
--- a/nixos/modules/services/mail/sympa.nix
+++ b/nixos/modules/services/mail/sympa.nix
@@ -218,7 +218,7 @@ in
         default = null;
         example = "/run/keys/sympa-dbpassword";
         description = lib.mdDoc ''
-          A file containing the password for {option}`services.sympa.database.user`.
+          A file containing the password for {option}`services.sympa.database.name`.
         '';
       };
 
@@ -342,6 +342,7 @@ in
 
       db_type = cfg.database.type;
       db_name = cfg.database.name;
+      db_user = cfg.database.name;
     }
     // (optionalAttrs (cfg.database.host != null) {
       db_host = cfg.database.host;
@@ -355,9 +356,6 @@ in
     // (optionalAttrs (cfg.database.port != null) {
       db_port = cfg.database.port;
     })
-    // (optionalAttrs (cfg.database.user != null) {
-      db_user = cfg.database.user;
-    })
     // (optionalAttrs (cfg.mta.type == "postfix") {
       sendmail_aliases = "${dataDir}/sympa_transport";
       aliases_program  = "${pkgs.postfix}/bin/postmap";
@@ -393,7 +391,7 @@ in
     users.groups.${group} = {};
 
     assertions = [
-      { assertion = cfg.database.createLocally -> cfg.database.user == user;
+      { assertion = cfg.database.createLocally -> cfg.database.user == user && cfg.database.name == cfg.database.user;
         message = "services.sympa.database.user must be set to ${user} if services.sympa.database.createLocally is set to true";
       }
       { assertion = cfg.database.createLocally -> cfg.database.passwordFile == null;
@@ -579,7 +577,7 @@ in
       ensureDatabases = [ cfg.database.name ];
       ensureUsers = [
         { name = cfg.database.user;
-          ensurePermissions = { "DATABASE ${cfg.database.name}" = "ALL PRIVILEGES"; };
+          ensureDBOwnership = true;
         }
       ];
     };