summaryrefslogtreecommitdiff
path: root/hosts/surtr
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/surtr')
-rw-r--r--hosts/surtr/email/default.nix26
1 files changed, 18 insertions, 8 deletions
diff --git a/hosts/surtr/email/default.nix b/hosts/surtr/email/default.nix
index a6fbcaf3..f4543bf4 100644
--- a/hosts/surtr/email/default.nix
+++ b/hosts/surtr/email/default.nix
@@ -137,11 +137,13 @@ in {
137 recipient_canonical_classes = ["envelope_recipient" "header_recipient"]; 137 recipient_canonical_classes = ["envelope_recipient" "header_recipient"];
138 138
139 virtual_mailbox_domains = ''pgsql:${pkgs.writeText "virtual_mailbox_domains.cf" '' 139 virtual_mailbox_domains = ''pgsql:${pkgs.writeText "virtual_mailbox_domains.cf" ''
140 hosts = postgresql://localhost/emails 140 hosts = postgresql://localhost
141 dbname = emails
141 query = SELECT domain FROM virtual_mailbox_domain WHERE domain = '%s' 142 query = SELECT domain FROM virtual_mailbox_domain WHERE domain = '%s'
142 ''}''; 143 ''}'';
143 virtual_mailbox_maps = ''pgsql:${pkgs.writeText "virtual_mailbox_maps.cf" '' 144 virtual_mailbox_maps = ''pgsql:${pkgs.writeText "virtual_mailbox_maps.cf" ''
144 hosts = postgresql://localhost/emails 145 hosts = postgresql://localhost
146 dbname = emails
145 query = SELECT mailbox FROM virtual_mailbox_mapping WHERE mailbox = '%s' 147 query = SELECT mailbox FROM virtual_mailbox_mapping WHERE mailbox = '%s'
146 ''}''; 148 ''}'';
147 virtual_transport = "lmtp:unix:/run/postfix/dovecot-lmtp"; 149 virtual_transport = "lmtp:unix:/run/postfix/dovecot-lmtp";
@@ -280,7 +282,14 @@ in {
280 mailLocation = "maildir:/var/lib/mail/%u/maildir:UTF-8"; 282 mailLocation = "maildir:/var/lib/mail/%u/maildir:UTF-8";
281 modules = with pkgs; [ dovecot_pigeonhole ]; 283 modules = with pkgs; [ dovecot_pigeonhole ];
282 protocols = [ "lmtp" "sieve" ]; 284 protocols = [ "lmtp" "sieve" ];
283 extraConfig = '' 285 extraConfig = let
286 dovecotSqlConf = pkgs.writeText "dovecot-sql.conf" ''
287 driver = pgsql
288 connect = dbname=email
289 password_query = SELECT user, quota_rule FROM imap_user WHERE user = '%u'
290 user_query = SELECT user, quota_rule FROM imap_user WHERE user = '%u'
291 '';
292 in ''
284 mail_home = /var/lib/mail/%u 293 mail_home = /var/lib/mail/%u
285 294
286 local_name imap.bouncy.email { 295 local_name imap.bouncy.email {
@@ -306,11 +315,12 @@ in {
306 315
307 userdb { 316 userdb {
308 driver = sql 317 driver = sql
309 args = ${pkgs.writeText "dovecot-sql.conf" '' 318 args = ${dovecotSqlConf}
310 driver = pgsql 319 default_fields = uid=dovecot2 gid=dovecot2 nopassword
311 connect = dbname=email 320 }
312 user_query = SELECT user, quota_rule FROM imap_user WHERE user = '%u' 321 passdb {
313 ''} 322 driver = sql
323 args = ${dovecotSqlConf}
314 default_fields = uid=dovecot2 gid=dovecot2 nopassword 324 default_fields = uid=dovecot2 gid=dovecot2 nopassword
315 } 325 }
316 326