From bb9143e01d74ffc5a47bfac4f16c59c776ac7187 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 9 Mar 2024 10:03:16 +0000 Subject: [PATCH] exim: Add pgsql, sqlite, json, and srs support While disabled by default, this adds support for postgresql, sqlite, and json lookups in exim. Also this adds support for enabling exim's sender-rewrite-scheme capability. Signed-off-by: Daniel Silverstone --- pkgs/servers/mail/exim/default.nix | 32 +++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/mail/exim/default.nix b/pkgs/servers/mail/exim/default.nix index a7f0a1986b99..b5446f7df190 100644 --- a/pkgs/servers/mail/exim/default.nix +++ b/pkgs/servers/mail/exim/default.nix @@ -3,11 +3,15 @@ , procps, killall , enableLDAP ? false, openldap , enableMySQL ? false, libmysqlclient, zlib +, enablePgSQL ? false, postgresql +, enableSqlite ? false, sqlite , enableAuthDovecot ? false, dovecot , enablePAM ? false, pam , enableSPF ? true, libspf2 , enableDMARC ? true, opendmarc , enableRedis ? false, hiredis +, enableJSON ? false, jansson +, enableSRS ? false, }: let perl' = perl.withPackages (p: with p; [ FileFcntlLock ]); @@ -26,11 +30,14 @@ in stdenv.mkDerivation rec { buildInputs = [ coreutils db openssl perl' pcre2 libxcrypt ] ++ lib.optional enableLDAP openldap ++ lib.optionals enableMySQL [ libmysqlclient zlib ] + ++ lib.optional enablePgSQL postgresql + ++ lib.optionals enableSqlite [ sqlite sqlite.dev zlib ] ++ lib.optional enableAuthDovecot dovecot ++ lib.optional enablePAM pam ++ lib.optional enableSPF libspf2 ++ lib.optional enableDMARC opendmarc - ++ lib.optional enableRedis hiredis; + ++ lib.optional enableRedis hiredis + ++ lib.optional enableJSON jansson; configurePhase = '' runHook preConfigure @@ -71,9 +78,25 @@ in stdenv.mkDerivation rec { s:^# \(LOOKUP_LIBS\)=.*:\1=-lmysqlclient -L${libmysqlclient}/lib/mysql -lssl -lm -lpthread -lz: s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${libmysqlclient.dev}/include/mysql/: ''} + ${lib.optionalString enablePgSQL '' + s:^# \(LOOKUP_PGSQL=yes\)$:\1: + s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -lpq -L${postgresql.lib}/lib: + s:^# \(LOOKUP_LIBS\)=.*:\1=-lpq -L${postgresql.lib}/lib: + s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${postgresql}/include: + ''} + ${lib.optionalString enableSqlite '' + s:^# \(LOOKUP_SQLITE=yes\)$:\1: + s:^# \(LOOKUP_SQLITE_PC=sqlite3\)$:\1: + s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -lsqlite3 -L${sqlite}/lib: + s:^# \(LOOKUP_LIBS\)=.*:\1=-lsqlite3 -L${sqlite}/lib -lssl -lm -lpthread -lz: + s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${sqlite.dev}/include: + ''} ${lib.optionalString enableAuthDovecot '' s:^# \(AUTH_DOVECOT\)=.*:\1=yes: ''} + ${lib.optionalString enableSRS '' + s:^# \(SUPPORT_SRS\)=.*:\1=yes: + ''} ${lib.optionalString enablePAM '' s:^# \(SUPPORT_PAM\)=.*:\1=yes: s:^\(EXTRALIBS_EXIM\)=\(.*\):\1=\2 -lpam: @@ -94,6 +117,13 @@ in stdenv.mkDerivation rec { s:^\(LOOKUP_INCLUDE\)=\(.*\):\1=\2 -I${hiredis}/include/hiredis/: s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${hiredis}/include/hiredis/: ''} + ${lib.optionalString enableJSON '' + s:^# \(LOOKUP_JSON=yes\)$:\1: + s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -ljansson -L${jansson}/lib: + s:^# \(LOOKUP_LIBS\)=.*:\1=-ljansson -L${jansson}/lib: + s:^\(LOOKUP_INCLUDE\)=\(.*\):\1=\2 -I${jansson}/include: + s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${jansson}/include: + ''} #/^\s*#.*/d #/^\s*$/d ' < src/EDITME > Local/Makefile