nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6 autoreconfHook,
7 dejagnu,
8 gettext,
9 gnum4,
10 pkg-config,
11 texinfo,
12 fribidi,
13 gdbm,
14 gnutls,
15 gss,
16 guile,
17 libmysqlclient,
18 mailcap,
19 net-tools,
20 pam,
21 readline,
22 ncurses,
23 python3,
24 gsasl,
25 system-sendmail,
26 libxcrypt,
27 mkpasswd,
28
29 pythonSupport ? true,
30 guileSupport ? true,
31}:
32
33stdenv.mkDerivation (finalAttrs: {
34 pname = "mailutils";
35 version = "3.19";
36
37 src = fetchurl {
38 url = "mirror://gnu/mailutils/mailutils-${finalAttrs.version}.tar.xz";
39 hash = "sha256-UCMNIANsW4rYyWsNmWF38fEz+6THx+O0YtOe6zCEn0U=";
40 };
41
42 separateDebugInfo = true;
43
44 postPatch = ''
45 sed -i -e '/chown root:mail/d' \
46 -e 's/chmod [24]755/chmod 0755/' \
47 */Makefile{.in,.am}
48 sed -i 's:/usr/lib/mysql:${libmysqlclient}/lib/mysql:' configure.ac
49 '';
50
51 nativeBuildInputs = [
52 autoreconfHook
53 gettext
54 gnum4
55 pkg-config
56 texinfo
57 ];
58
59 buildInputs = [
60 fribidi
61 gdbm
62 gnutls
63 gss
64 libmysqlclient
65 mailcap
66 ncurses
67 pam
68 readline
69 gsasl
70 libxcrypt
71 ]
72 ++ lib.optionals stdenv.hostPlatform.isLinux [ net-tools ]
73 ++ lib.optionals pythonSupport [ python3 ]
74 ++ lib.optionals guileSupport [ guile ];
75
76 patches = [
77 ./fix-build-mb-len-max.patch
78 ./path-to-cat.patch
79 # Fix cross-compilation
80 # https://lists.gnu.org/archive/html/bug-mailutils/2020-11/msg00038.html
81 (fetchpatch {
82 url = "https://lists.gnu.org/archive/html/bug-mailutils/2020-11/txtiNjqcNpqOk.txt";
83 hash = "sha256-2rhuopBANngq/PRCboIr+ewdawr8472cYwiLjtHCHz4=";
84 })
85 # Avoid hardeningDisable = [ "format" ]; - this patch is from the project's master branch and can be removed at the next version
86 (fetchpatch {
87 url = "https://cgit.git.savannah.gnu.org/cgit/mailutils.git/patch/?id=9379ec9e25ae6bdbd3d6f5ef9930ac2176d2efe7";
88 hash = "sha256-00R1DLMDPsvz3R6UgRO1ZvgMNCiHYS3lfjqAC9VD+Y4=";
89 })
90 # https://github.com/NixOS/nixpkgs/issues/223967
91 # https://lists.gnu.org/archive/html/bug-mailutils/2023-04/msg00000.html
92 ./don-t-use-descrypt-password-in-the-test-suite.patch
93 # Fix build with gcc15
94 # https://lists.gnu.org/archive/html/bug-mailutils/2025-06/msg00000.html
95 (fetchpatch {
96 name = "mailutils-fix-sighandler-incompatible-pointer-types-gcc15.patch";
97 url = "https://gitlab.archlinux.org/archlinux/packaging/packages/mailutils/-/raw/87c3614083260f52dd1222e872a1836f0ff9abe1/fix-build.patch";
98 hash = "sha256-RN62l5mYqtViEjXpAlQKWhFez1TPynRMj/1nvZkq5Gs=";
99 })
100 ];
101
102 enableParallelBuilding = true;
103 strictDeps = true;
104
105 configureFlags = [
106 "--sysconfdir=/etc"
107 "--with-gssapi"
108 "--with-gsasl"
109 "--with-mysql"
110 "--with-path-sendmail=${system-sendmail}/bin/sendmail"
111 "--with-mail-rc=/etc/mail.rc"
112 "DEFAULT_CUPS_CONFDIR=${mailcap}/etc" # provides mime.types to mimeview
113 ]
114 ++ lib.optional (!pythonSupport) "--without-python"
115 ++ lib.optional (!guileSupport) "--without-guile";
116
117 nativeCheckInputs = [
118 dejagnu
119 mkpasswd
120 ];
121
122 doCheck = !stdenv.hostPlatform.isDarwin; # ERROR: All 46 tests were run, 46 failed unexpectedly.
123
124 meta = {
125 description = "Rich and powerful protocol-independent mail framework";
126
127 longDescription = ''
128 GNU Mailutils is a rich and powerful protocol-independent mail
129 framework. It contains a series of useful mail libraries, clients, and
130 servers. These are the primary mail utilities for the GNU system. The
131 central library is capable of handling electronic mail in various
132 mailbox formats and protocols, both local and remote. Specifically,
133 this project contains a POP3 server, an IMAP4 server, and a Sieve mail
134 filter. It also provides a POSIX `mailx' client, and a collection of
135 other handy tools.
136
137 The GNU Mailutils libraries supply an ample set of primitives for
138 handling electronic mail in programs written in C, C++, Python or
139 Scheme.
140
141 The utilities provided by Mailutils include imap4d and pop3d mail
142 servers, mail reporting utility comsatd, mail filtering program sieve,
143 and an implementation of MH message handling system.
144 '';
145
146 license = with lib.licenses; [
147 lgpl3Plus # libraries
148 gpl3Plus # tools
149 ];
150
151 maintainers = [ ];
152
153 homepage = "https://www.gnu.org/software/mailutils/";
154 changelog = "https://git.savannah.gnu.org/cgit/mailutils.git/tree/NEWS";
155
156 # Some of the dependencies fail to build on {cyg,dar}win.
157 platforms = lib.platforms.gnu ++ lib.platforms.unix;
158 };
159})