1{
2 stdenv,
3 fetchurl,
4 lib,
5 tls ? true,
6 gnutls ? null,
7}:
8
9assert tls -> gnutls != null;
10
11stdenv.mkDerivation rec {
12
13 version = "2.2";
14 pname = "nullmailer";
15
16 src = fetchurl {
17 url = "https://untroubled.org/nullmailer/nullmailer-${version}.tar.gz";
18 sha256 = "0md8cf90fl2yf3zh9njjy42a673v4j4ygyq95xg7fzkygdigm1lq";
19 };
20
21 buildInputs = lib.optional tls gnutls;
22
23 configureFlags = [
24 "--sysconfdir=/etc"
25 "--localstatedir=/var"
26 ]
27 ++ lib.optional tls "--enable-tls";
28
29 installFlags = [ "DESTDIR=$(out)" ];
30
31 # We have to remove the ''var'' directory, since nix can't handle named pipes
32 # and we can't use it in the store anyway. Same for ''etc''.
33 # The second line is need, because the installer of nullmailer will copy its
34 # own prepared version of ''etc'' and ''var'' and also uses the prefix path (configure phase)
35 # for hardcoded absolute references to its own binary farm, e.g. sendmail binary is
36 # calling nullmailer-inject binary. Since we can't configure inside the store of
37 # the derivation we need both directories in the root, but don't want to put them there
38 # during install, hence we have to fix mumbling inside the install directory.
39 # This is kind of a hack, but the only way I know of, yet.
40 postInstall = ''
41 rm -rf $out/var/ $out/etc/
42 mv $out/$out/* $out/
43 rmdir $out/$out
44 '';
45
46 enableParallelBuilding = true;
47
48 meta = {
49 homepage = "http://untroubled.org/nullmailer/";
50 description = ''
51 A sendmail/qmail/etc replacement MTA for hosts which relay to a fixed set of smart relays.
52 It is designed to be simple to configure, secure, and easily extendable.
53 '';
54 license = lib.licenses.gpl2Plus;
55 platforms = lib.platforms.all;
56 maintainers = with lib.maintainers; [ sargon ];
57 };
58}