evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / by-name / ex / exim / package.nix
blobbf593354da92f5287045f7bd4da92cb479d48e7b
1 { coreutils, db, fetchurl, openssl, pcre2, perl, pkg-config, lib, stdenv
2 , libxcrypt
3 , procps, killall
4 , enableLDAP ? false, openldap
5 , enableMySQL ? false, libmysqlclient, zlib
6 , enablePgSQL ? false, postgresql
7 , enableSqlite ? false, sqlite
8 , enableAuthDovecot ? false, dovecot
9 , enablePAM ? false, pam
10 , enableSPF ? true, libspf2
11 , enableDMARC ? true, opendmarc
12 , enableRedis ? false, hiredis
13 , enableJSON ? false, jansson
14 , enableSRS ? false,
16 let
17   perl' = perl.withPackages (p: with p; [ FileFcntlLock ]);
18 in stdenv.mkDerivation rec {
19   pname = "exim";
20   version = "4.98";
22   src = fetchurl {
23     url = "https://ftp.exim.org/pub/exim/exim4/${pname}-${version}.tar.xz";
24     hash = "sha256-DrwQinefkpO6S0I8IIGPmj23m2AobZarxrprhaFYUvc=";
25   };
27   enableParallelBuilding = true;
29   nativeBuildInputs = [ pkg-config ];
30   buildInputs = [ coreutils db openssl perl' pcre2 libxcrypt ]
31     ++ lib.optional enableLDAP openldap
32     ++ lib.optionals enableMySQL [ libmysqlclient zlib ]
33     ++ lib.optional enablePgSQL postgresql
34     ++ lib.optionals enableSqlite [ sqlite sqlite.dev zlib ]
35     ++ lib.optional enableAuthDovecot dovecot
36     ++ lib.optional enablePAM pam
37     ++ lib.optional enableSPF libspf2
38     ++ lib.optional enableDMARC opendmarc
39     ++ lib.optional enableRedis hiredis
40     ++ lib.optional enableJSON jansson;
42   configurePhase = ''
43     runHook preConfigure
45     sed '
46       s:^\(BIN_DIRECTORY\)=.*:\1='"$out"'/bin:
47       s:^\(CONFIGURE_FILE\)=.*:\1=/etc/exim.conf:
48       s:^\(EXIM_USER\)=.*:\1=ref\:nobody:
49       s:^\(SPOOL_DIRECTORY\)=.*:\1=/exim-homeless-shelter:
50       s:^# \(TRANSPORT_LMTP\)=.*:\1=yes:
51       s:^# \(SUPPORT_MAILDIR\)=.*:\1=yes:
52       s:^EXIM_MONITOR=.*$:# &:
53       s:^\(FIXED_NEVER_USERS\)=root$:\1=0:
54       s:^# \(WITH_CONTENT_SCAN\)=.*:\1=yes:
55       s:^# \(AUTH_PLAINTEXT\)=.*:\1=yes:
56       s:^# \(USE_OPENSSL\)=.*:\1=yes:
57       s:^# \(USE_OPENSSL_PC=openssl\)$:\1:
58       s:^# \(LOG_FILE_PATH=syslog\)$:\1:
59       s:^# \(HAVE_IPV6=yes\)$:\1:
60       s:^# \(CHOWN_COMMAND\)=.*:\1=${coreutils}/bin/chown:
61       s:^# \(CHGRP_COMMAND\)=.*:\1=${coreutils}/bin/chgrp:
62       s:^# \(CHMOD_COMMAND\)=.*:\1=${coreutils}/bin/chmod:
63       s:^# \(MV_COMMAND\)=.*:\1=${coreutils}/bin/mv:
64       s:^# \(RM_COMMAND\)=.*:\1=${coreutils}/bin/rm:
65       s:^# \(TOUCH_COMMAND\)=.*:\1=${coreutils}/bin/touch:
66       s:^# \(PERL_COMMAND\)=.*:\1=${perl'}/bin/perl:
67       s:^# \(LOOKUP_DSEARCH=yes\)$:\1:
68       ${lib.optionalString enableLDAP ''
69         s:^# \(LDAP_LIB_TYPE=OPENLDAP2\)$:\1:
70         s:^# \(LOOKUP_LDAP=yes\)$:\1:
71         s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -lldap -llber:
72         s:^# \(LOOKUP_LIBS\)=.*:\1=-lldap -llber:
73       ''}
74       ${lib.optionalString enableMySQL ''
75         s:^# \(LOOKUP_MYSQL=yes\)$:\1:
76         s:^# \(LOOKUP_MYSQL_PC=libmysqlclient\)$:\1:
77         s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -lmysqlclient -L${libmysqlclient}/lib/mysql -lssl -lm -lpthread -lz:
78         s:^# \(LOOKUP_LIBS\)=.*:\1=-lmysqlclient -L${libmysqlclient}/lib/mysql -lssl -lm -lpthread -lz:
79         s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${libmysqlclient.dev}/include/mysql/:
80       ''}
81       ${lib.optionalString enablePgSQL ''
82         s:^# \(LOOKUP_PGSQL=yes\)$:\1:
83         s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -lpq -L${postgresql.lib}/lib:
84         s:^# \(LOOKUP_LIBS\)=.*:\1=-lpq -L${postgresql.lib}/lib:
85       ''}
86       ${lib.optionalString enableSqlite ''
87         s:^# \(LOOKUP_SQLITE=yes\)$:\1:
88         s:^# \(LOOKUP_SQLITE_PC=sqlite3\)$:\1:
89         s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -lsqlite3 -L${sqlite}/lib:
90         s:^# \(LOOKUP_LIBS\)=.*:\1=-lsqlite3 -L${sqlite}/lib -lssl -lm -lpthread -lz:
91         s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${sqlite.dev}/include:
92       ''}
93       ${lib.optionalString enableAuthDovecot ''
94         s:^# \(AUTH_DOVECOT\)=.*:\1=yes:
95       ''}
96       ${lib.optionalString enableSRS ''
97         s:^# \(SUPPORT_SRS\)=.*:\1=yes:
98       ''}
99       ${lib.optionalString enablePAM ''
100         s:^# \(SUPPORT_PAM\)=.*:\1=yes:
101         s:^\(EXTRALIBS_EXIM\)=\(.*\):\1=\2 -lpam:
102         s:^# \(EXTRALIBS_EXIM\)=.*:\1=-lpam:
103       ''}
104       ${lib.optionalString enableSPF ''
105         s:^# \(SUPPORT_SPF\)=.*:\1=yes:
106         s:^# \(LDFLAGS += -lspf2\):\1:
107       ''}
108       ${lib.optionalString enableDMARC ''
109         s:^# \(SUPPORT_DMARC\)=.*:\1=yes:
110         s:^# \(LDFLAGS += -lopendmarc\):\1:
111       ''}
112       ${lib.optionalString enableRedis ''
113         s:^# \(LOOKUP_REDIS=yes\)$:\1:
114         s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -lhiredis -L${hiredis}/lib/hiredis:
115         s:^# \(LOOKUP_LIBS\)=.*:\1=-lhiredis -L${hiredis}/lib/hiredis:
116         s:^\(LOOKUP_INCLUDE\)=\(.*\):\1=\2 -I${hiredis}/include/hiredis/:
117         s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${hiredis}/include/hiredis/:
118       ''}
119       ${lib.optionalString enableJSON ''
120         s:^# \(LOOKUP_JSON=yes\)$:\1:
121         s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -ljansson -L${jansson}/lib:
122         s:^# \(LOOKUP_LIBS\)=.*:\1=-ljansson -L${jansson}/lib:
123         s:^\(LOOKUP_INCLUDE\)=\(.*\):\1=\2 -I${jansson}/include:
124         s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${jansson}/include:
125       ''}
126       #/^\s*#.*/d
127       #/^\s*$/d
128     ' < src/EDITME > Local/Makefile
130     {
131       echo EXIWHAT_PS_CMD=${procps}/bin/ps
132       echo EXIWHAT_MULTIKILL_CMD=${killall}/bin/killall
133     } >> Local/Makefile
135     runHook postConfigure
136   '';
138   installPhase = ''
139     runHook preInstall
141     mkdir -p $out/bin $out/share/man/man8
142     cp doc/exim.8 $out/share/man/man8
144     ( cd build-Linux-*
145       cp exicyclog exim_checkaccess exim_dumpdb exim_lock exim_tidydb \
146         exipick exiqsumm exigrep exim_dbmbuild exim exim_fixdb eximstats \
147         exinext exiqgrep exiwhat \
148         $out/bin )
150     ( cd $out/bin
151       for i in mailq newaliases rmail rsmtp runq sendmail; do
152         ln -s exim $i
153       done )
155     runHook postInstall
156   '';
158   meta = with lib; {
159     homepage = "https://exim.org/";
160     description = "Mail transfer agent (MTA)";
161     license = with licenses; [ gpl2Plus bsd3 ];
162     mainProgram = "exim";
163     platforms = platforms.linux;
164     maintainers = with maintainers; [ tv ] ++ teams.helsinki-systems.members;
165     changelog = "https://github.com/Exim/exim/blob/exim-${version}/doc/doc-txt/ChangeLog";
166   };