2016-03-11 14:37:50 +00:00
|
|
|
{ stdenv, lib, fetchurl, makeWrapper, gnused, db, openssl, cyrus_sasl
|
|
|
|
, coreutils, findutils, gnugrep, gawk, icu, pcre
|
|
|
|
, withPgSQL ? false, postgresql
|
|
|
|
, withMySQL ? false, libmysql
|
|
|
|
, withSQLite ? false, sqlite
|
2017-06-06 12:01:06 +01:00
|
|
|
, withLDAP ? false, openldap
|
2010-08-06 11:34:34 +01:00
|
|
|
}:
|
2006-03-10 23:48:34 +00:00
|
|
|
|
2016-03-11 14:37:50 +00:00
|
|
|
let
|
|
|
|
ccargs = lib.concatStringsSep " " ([
|
2016-04-16 17:48:19 +01:00
|
|
|
"-DUSE_TLS" "-DUSE_SASL_AUTH" "-DUSE_CYRUS_SASL" "-I${cyrus_sasl.dev}/include/sasl"
|
2016-03-11 14:37:50 +00:00
|
|
|
"-DHAS_DB_BYPASS_MAKEDEFS_CHECK"
|
|
|
|
] ++ lib.optional withPgSQL "-DHAS_PGSQL"
|
2016-08-01 16:46:30 +01:00
|
|
|
++ lib.optionals withMySQL [ "-DHAS_MYSQL" "-I${lib.getDev libmysql}/include/mysql" ]
|
2017-06-06 12:01:06 +01:00
|
|
|
++ lib.optional withSQLite "-DHAS_SQLITE"
|
|
|
|
++ lib.optional withLDAP "-DHAS_LDAP");
|
2016-03-11 14:37:50 +00:00
|
|
|
auxlibs = lib.concatStringsSep " " ([
|
2016-03-15 01:44:24 +00:00
|
|
|
"-ldb" "-lnsl" "-lresolv" "-lsasl2" "-lcrypto" "-lssl"
|
2016-03-11 14:37:50 +00:00
|
|
|
] ++ lib.optional withPgSQL "-lpq"
|
|
|
|
++ lib.optional withMySQL "-lmysqlclient"
|
2017-06-06 12:01:06 +01:00
|
|
|
++ lib.optional withSQLite "-lsqlite3"
|
|
|
|
++ lib.optional withLDAP "-lldap");
|
2008-06-13 13:03:55 +01:00
|
|
|
|
2016-03-11 14:37:50 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
|
|
|
|
name = "postfix-${version}";
|
|
|
|
|
2017-09-28 14:53:21 +01:00
|
|
|
version = "3.2.3";
|
2012-08-28 14:13:21 +01:00
|
|
|
|
2006-03-10 23:48:34 +00:00
|
|
|
src = fetchurl {
|
2012-08-28 14:14:03 +01:00
|
|
|
url = "ftp://ftp.cs.uu.nl/mirror/postfix/postfix-release/official/${name}.tar.gz";
|
2017-09-28 14:53:21 +01:00
|
|
|
sha256 = "1gs025smgynrlsg44cypjam99ds92mc9q46l5085d9sy0xfrf2sv";
|
2006-03-10 23:48:34 +00:00
|
|
|
};
|
|
|
|
|
2016-03-11 14:37:50 +00:00
|
|
|
buildInputs = [ makeWrapper gnused db openssl cyrus_sasl icu pcre ]
|
|
|
|
++ lib.optional withPgSQL postgresql
|
|
|
|
++ lib.optional withMySQL libmysql
|
2017-06-06 12:01:06 +01:00
|
|
|
++ lib.optional withSQLite sqlite
|
|
|
|
++ lib.optional withLDAP openldap;
|
2008-06-30 22:11:07 +01:00
|
|
|
|
2016-02-26 17:38:15 +00:00
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
hardeningEnable = [ "pie" ];
|
2016-02-12 15:29:23 +00:00
|
|
|
|
2015-12-31 09:02:45 +00:00
|
|
|
patches = [
|
|
|
|
./postfix-script-shell.patch
|
2016-03-11 14:37:50 +00:00
|
|
|
./postfix-3.0-no-warnings.patch
|
|
|
|
./post-install-script.patch
|
|
|
|
./relative-symlinks.patch
|
2015-12-31 09:02:45 +00:00
|
|
|
];
|
2012-08-28 14:17:06 +01:00
|
|
|
|
2008-06-13 05:30:57 +01:00
|
|
|
preBuild = ''
|
2016-03-11 14:37:50 +00:00
|
|
|
sed -e '/^PATH=/d' -i postfix-install
|
|
|
|
sed -e "s|@PACKAGE@|$out|" -i conf/post-install
|
|
|
|
|
|
|
|
# post-install need skip permissions check/set on all symlinks following to /nix/store
|
|
|
|
sed -e "s|@NIX_STORE@|$NIX_STORE|" -i conf/post-install
|
|
|
|
|
2008-06-13 05:30:57 +01:00
|
|
|
export command_directory=$out/sbin
|
2016-03-11 14:37:50 +00:00
|
|
|
export config_directory=/etc/postfix
|
|
|
|
export meta_directory=$out/etc/postfix
|
|
|
|
export daemon_directory=$out/libexec/postfix
|
|
|
|
export data_directory=/var/lib/postfix/data
|
2008-06-13 05:30:57 +01:00
|
|
|
export html_directory=$out/share/postfix/doc/html
|
2016-03-11 14:37:50 +00:00
|
|
|
export mailq_path=$out/bin/mailq
|
2008-06-13 05:30:57 +01:00
|
|
|
export manpage_directory=$out/share/man
|
2016-03-11 14:37:50 +00:00
|
|
|
export newaliases_path=$out/bin/newaliases
|
|
|
|
export queue_directory=/var/lib/postfix/queue
|
2008-06-13 05:30:57 +01:00
|
|
|
export readme_directory=$out/share/postfix/doc
|
2016-03-11 14:37:50 +00:00
|
|
|
export sendmail_path=$out/bin/sendmail
|
2008-06-30 22:11:07 +01:00
|
|
|
|
2016-03-11 14:37:50 +00:00
|
|
|
make makefiles CCARGS='${ccargs}' AUXLIBS='${auxlibs}'
|
2008-06-13 05:30:57 +01:00
|
|
|
'';
|
|
|
|
|
2016-03-11 14:37:50 +00:00
|
|
|
installTargets = [ "non-interactive-package" ];
|
2011-11-05 21:14:30 +00:00
|
|
|
|
2016-03-11 14:37:50 +00:00
|
|
|
installFlags = [ "install_root=installdir" ];
|
2012-08-28 14:17:06 +01:00
|
|
|
|
2016-03-11 14:37:50 +00:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out
|
|
|
|
mv -v installdir/$out/* $out/
|
|
|
|
cp -rv installdir/etc $out
|
|
|
|
sed -e '/^PATH=/d' -i $out/libexec/postfix/post-install
|
|
|
|
wrapProgram $out/libexec/postfix/post-install \
|
2016-08-22 23:13:49 +01:00
|
|
|
--prefix PATH ":" ${lib.makeBinPath [ coreutils findutils gnugrep ]}
|
2016-03-11 14:37:50 +00:00
|
|
|
wrapProgram $out/libexec/postfix/postfix-script \
|
2016-08-22 23:13:49 +01:00
|
|
|
--prefix PATH ":" ${lib.makeBinPath [ coreutils findutils gnugrep gawk gnused ]}
|
2012-08-28 14:17:06 +01:00
|
|
|
'';
|
|
|
|
|
2012-08-28 14:13:34 +01:00
|
|
|
meta = {
|
2017-08-01 21:03:30 +01:00
|
|
|
homepage = http://www.postfix.org/;
|
2016-03-11 14:37:50 +00:00
|
|
|
description = "A fast, easy to administer, and secure mail server";
|
|
|
|
license = lib.licenses.bsdOriginal;
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
maintainers = [ lib.maintainers.rickynils ];
|
2012-08-28 14:13:34 +01:00
|
|
|
};
|
2016-03-11 14:37:50 +00:00
|
|
|
|
2006-03-10 23:48:34 +00:00
|
|
|
}
|