summary refs log tree commit diff
path: root/pkgs/servers/mail/opensmtpd/extras.nix
blob: 803ba0ee6c75bef4228c9a3a5bbf51d1ed2289ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{ stdenv, fetchurl, openssl, libevent, libasr,
  python2, pkgconfig, lua5, perl, libmysqlclient, postgresql, sqlite, hiredis,
  enablePython ? true,
  enableLua ? true,
  enablePerl ? true,
  enableMysql ? true,
  enablePostgres ? true,
  enableSqlite ? true,
  enableRedis ? true,
}:

stdenv.mkDerivation rec {
  pname = "opensmtpd-extras";
  version = "6.4.0";

  src = fetchurl {
    url = "https://www.opensmtpd.org/archives/${pname}-${version}.tar.gz";
    sha256 = "09k25l7zy5ch3fk6qphni2h0rxdp8wacmfag1whi608dgimrhrnb";
  };

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ openssl libevent
    libasr python2 lua5 perl libmysqlclient postgresql sqlite hiredis ];

  configureFlags = [
    "--sysconfdir=/etc"
    "--localstatedir=/var"
    "--with-privsep-user=smtpd"
    "--with-libevent-dir=${libevent.dev}"

    "--with-filter-clamav"
    "--with-filter-dkim-signer"
    "--with-filter-dnsbl"
    "--with-filter-monkey"
    "--with-filter-pause"
    "--with-filter-regex"
    "--with-filter-spamassassin"
    "--with-filter-stub"
    "--with-filter-trace"
    "--with-filter-void"
    "--with-queue-null"
    "--with-queue-ram"
    "--with-queue-stub"
    "--with-table-ldap"
    "--with-table-socketmap"
    "--with-table-passwd"
    "--with-table-stub"
    "--with-scheduler-ram"
    "--with-scheduler-stub"

  ] ++ stdenv.lib.optionals enablePython [
    "--with-python=${python2}"
    "--with-filter-python"
    "--with-queue-python"
    "--with-table-python"
    "--with-scheduler-python"

  ] ++ stdenv.lib.optionals enableLua [
    "--with-lua=${pkgconfig}"
    "--with-filter-lua"

  ] ++ stdenv.lib.optionals enablePerl [
    "--with-perl=${perl}"
    "--with-filter-perl"

  ] ++ stdenv.lib.optionals enableMysql [
    "--with-table-mysql"

  ] ++ stdenv.lib.optionals enablePostgres [
    "--with-table-postgres"

  ] ++ stdenv.lib.optionals enableSqlite [
    "--with-table-sqlite"

  ] ++ stdenv.lib.optionals enableRedis [
    "--with-table-redis"
  ];

  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString enableRedis
      "-I${hiredis}/include/hiredis -lhiredis"
    + stdenv.lib.optionalString enableMysql
      " -L${libmysqlclient}/lib/mysql";

  meta = with stdenv.lib; {
    homepage = "https://www.opensmtpd.org/";
    description = "Extra plugins for the OpenSMTPD mail server";
    license = licenses.isc;
    platforms = platforms.linux;
    maintainers = with maintainers; [ gebner ekleog ];
  };
}