nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 autoreconfHook,
6 autoconf-archive,
7 pkgconf,
8 libtool,
9 bison,
10 libevent,
11 zlib,
12 libressl,
13 db,
14 pam,
15 libxcrypt,
16 nixosTests,
17}:
18
19stdenv.mkDerivation rec {
20 pname = "opensmtpd";
21 version = "7.8.0p0";
22
23 nativeBuildInputs = [
24 autoreconfHook
25 autoconf-archive
26 pkgconf
27 libtool
28 bison
29 ];
30 buildInputs = [
31 libevent
32 zlib
33 libressl
34 db
35 pam
36 libxcrypt
37 ];
38
39 src = fetchurl {
40 url = "https://www.opensmtpd.org/archives/${pname}-${version}.tar.gz";
41 hash = "sha256-QDTeLpLGH6g+7a2x2Ni9/mXlfrUM6WeeAUCVDjTKSrc=";
42 };
43
44 patches = [
45 ./proc_path.diff # TODO: upstream to OpenSMTPD, see https://github.com/NixOS/nixpkgs/issues/54045
46 ];
47
48 postPatch = ''
49 substituteInPlace mk/smtpctl/Makefile.am --replace "chgrp" "true"
50 substituteInPlace mk/smtpctl/Makefile.am --replace "chmod 2555" "chmod 0555"
51 '';
52
53 configureFlags = [
54 "--sysconfdir=/etc"
55 "--localstatedir=/var"
56 "--with-mantype=doc"
57 "--with-auth-pam"
58 "--without-auth-bsdauth"
59 "--with-path-socket=/run"
60 "--with-path-pidfile=/run"
61 "--with-user-smtpd=smtpd"
62 "--with-user-queue=smtpq"
63 "--with-group-queue=smtpq"
64 "--with-path-CAfile=/etc/ssl/certs/ca-certificates.crt"
65 "--with-libevent=${libevent.dev}"
66 "--with-table-db"
67 ];
68
69 installFlags = [
70 "sysconfdir=\${out}/etc"
71 "localstatedir=\${TMPDIR}"
72 ];
73
74 meta = {
75 homepage = "https://www.opensmtpd.org/";
76 description = ''
77 A free implementation of the server-side SMTP protocol as defined by
78 RFC 5321, with some additional standard extensions
79 '';
80 license = lib.licenses.isc;
81 platforms = lib.platforms.linux;
82 maintainers = with lib.maintainers; [
83 obadz
84 vifino
85 ];
86 };
87 passthru.tests = {
88 basic-functionality-and-dovecot-interaction = nixosTests.opensmtpd;
89 rspamd-integration = nixosTests.opensmtpd-rspamd;
90 };
91}