]> Git — Sourcephile - sourcephile-nix.git/blob - install/overlays/servers/mail/postfix.nix
nsd: fix MX record
[sourcephile-nix.git] / install / overlays / servers / mail / postfix.nix
1 # DESCRIPTION: add -DUSE_LDAP_SASL
2 # TODO: remove when using nixpkgs with https://github.com/NixOS/nixpkgs/pull/46883
3 self: super:
4 let
5 lib = super.lib;
6 ccargs = lib.concatStringsSep " " ([
7 "-DUSE_TLS" "-DUSE_SASL_AUTH" "-DUSE_CYRUS_SASL" "-I${self.cyrus_sasl.dev}/include/sasl"
8 "-DHAS_DB_BYPASS_MAKEDEFS_CHECK"
9 ] ++ lib.optional self.withPgSQL "-DHAS_PGSQL"
10 ++ lib.optionals self.withMySQL [ "-DHAS_MYSQL" "-I${self.mysql.connector-c}/include/mysql" "-L${self.mysql.connector-c}/lib/mysql" ]
11 ++ lib.optional self.withSQLite "-DHAS_SQLITE"
12 ++ lib.optional self.withLDAP "-DHAS_LDAP -DUSE_LDAP_SASL");
13 auxlibs = lib.concatStringsSep " " ([
14 "-ldb" "-lnsl" "-lresolv" "-lsasl2" "-lcrypto" "-lssl"
15 ] ++ lib.optional self.withPgSQL "-lpq"
16 ++ lib.optional self.withMySQL "-lmysqlclient"
17 ++ lib.optional self.withSQLite "-lsqlite3"
18 ++ lib.optional self.withLDAP "-lldap");
19 in {
20 withLDAP = true;
21 withPgSQL = false;
22 withMySQL = false;
23 withSQLite = false;
24 postfix = super.postfix.overrideAttrs (old: {
25 preBuild = ''
26 sed -e '/^PATH=/d' -i postfix-install
27 sed -e "s|@PACKAGE@|$out|" -i conf/post-install
28
29 # post-install need skip permissions check/set on all symlinks following to /nix/store
30 sed -e "s|@NIX_STORE@|$NIX_STORE|" -i conf/post-install
31
32 export command_directory=$out/sbin
33 export config_directory=/etc/postfix
34 export meta_directory=$out/etc/postfix
35 export daemon_directory=$out/libexec/postfix
36 export data_directory=/var/lib/postfix/data
37 export html_directory=$out/share/postfix/doc/html
38 export mailq_path=$out/bin/mailq
39 export manpage_directory=$out/share/man
40 export newaliases_path=$out/bin/newaliases
41 export queue_directory=/var/lib/postfix/queue
42 export readme_directory=$out/share/postfix/doc
43 export sendmail_path=$out/bin/sendmail
44
45 make makefiles CCARGS='${ccargs}' AUXLIBS='${auxlibs}'
46 '';
47 });
48 }