vacuum-go: 0.16.1 -> 0.16.2 (#380231)
[NixPkgs.git] / pkgs / applications / networking / mailreaders / neomutt / default.nix
blobd4f160ff788a36ef850dd022cf5423e867cd43f4
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   gettext,
6   makeWrapper,
7   tcl,
8   which,
9   ncurses,
10   perl,
11   cyrus_sasl,
12   gss,
13   gpgme,
14   libkrb5,
15   libidn2,
16   libxml2,
17   notmuch,
18   openssl,
19   lua,
20   lmdb,
21   libxslt,
22   docbook_xsl,
23   docbook_xml_dtd_42,
24   w3m,
25   mailcap,
26   sqlite,
27   zlib,
28   lndir,
29   pkg-config,
30   zstd,
31   enableZstd ? true,
32   enableMixmaster ? false,
33   enableLua ? false,
34   enableSmimeKeys ? true,
35   withContrib ? true,
38 assert lib.warnIf (
39   enableMixmaster
40 ) "Support for mixmaster has been removed from neomutt since the 20241002 release" true;
42 stdenv.mkDerivation (finalAttrs: {
43   pname = "neomutt";
44   version = "20241002";
46   src = fetchFromGitHub {
47     owner = "neomutt";
48     repo = "neomutt";
49     rev = finalAttrs.version;
50     hash = "sha256-c8G0CGg4jrwq+HVR4O0AtaJNzr7pDYsie1410tisLEY=";
51   };
53   buildInputs =
54     [
55       cyrus_sasl
56       gss
57       gpgme
58       libkrb5
59       libidn2
60       ncurses
61       notmuch
62       openssl
63       perl
64       lmdb
65       mailcap
66       sqlite
67     ]
68     ++ lib.optional enableZstd zstd
69     ++ lib.optional enableLua lua;
71   nativeBuildInputs = [
72     docbook_xsl
73     docbook_xml_dtd_42
74     gettext
75     libxml2
76     libxslt.bin
77     makeWrapper
78     tcl
79     which
80     zlib
81     w3m
82     pkg-config
83   ];
85   enableParallelBuilding = true;
87   postPatch = ''
88     substituteInPlace auto.def --replace /usr/sbin/sendmail sendmail
89     substituteInPlace contrib/smime_keys \
90       --replace /usr/bin/openssl ${openssl}/bin/openssl
92     for f in doc/*.{xml,xsl}*  ; do
93       substituteInPlace $f \
94         --replace http://docbook.sourceforge.net/release/xsl/current     ${docbook_xsl}/share/xml/docbook-xsl \
95         --replace http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd ${docbook_xml_dtd_42}/xml/dtd/docbook/docbookx.dtd
96     done
99     # allow neomutt to map attachments to their proper mime.types if specified wrongly
100     # and use a far more comprehensive list than the one shipped with neomutt
101     substituteInPlace send/sendlib.c \
102       --replace /etc/mime.types ${mailcap}/etc/mime.types
103   '';
105   configureFlags =
106     [
107       "--enable-autocrypt"
108       "--gpgme"
109       "--gss"
110       "--lmdb"
111       "--notmuch"
112       "--ssl"
113       "--sasl"
114       "--with-homespool=mailbox"
115       "--with-mailpath="
116       # To make it not reference .dev outputs. See:
117       # https://github.com/neomutt/neomutt/pull/2367
118       "--disable-include-path-in-cflags"
119       "--zlib"
120     ]
121     ++ lib.optional enableZstd "--zstd"
122     ++ lib.optional enableLua "--lua";
124   postInstall =
125     ''
126       wrapProgram "$out/bin/neomutt" --prefix PATH : "$out/libexec/neomutt"
127     ''
128     + lib.optionalString enableSmimeKeys ''
129       install -m 755 $src/contrib/smime_keys $out/bin;
130       substituteInPlace $out/bin/smime_keys \
131         --replace-fail '/usr/bin/openssl' '${openssl}/bin/openssl';
132     ''
133     # https://github.com/neomutt/neomutt-contrib
134     # Contains vim-keys, keybindings presets and more.
135     + lib.optionalString withContrib "${lib.getExe lndir} ${finalAttrs.passthru.contrib} $out/share/doc/neomutt";
137   doCheck = true;
139   preCheck = ''
140     cp -r ${finalAttrs.passthru.test-files} $(pwd)/test-files
142     chmod -R +w test-files
143     (cd test-files && ./setup.sh)
145     export NEOMUTT_TEST_DIR=$(pwd)/test-files
147     # The test fails with: node_padding.c:135: Check rc == 15... failed
148     substituteInPlace test/main.c \
149       --replace-fail "NEOMUTT_TEST_ITEM(test_expando_node_padding)" ""
150   '';
152   passthru = {
153     test-files = fetchFromGitHub {
154       owner = "neomutt";
155       repo = "neomutt-test-files";
156       rev = "00efc8388110208e77e6ed9d8294dfc333753d54";
157       hash = "sha256-/ELowuMq67v56MAJBtO73g6OqV0DVwW4+x+0u4P5mB0=";
158     };
159     contrib = fetchFromGitHub {
160       owner = "neomutt";
161       repo = "neomutt-contrib";
162       rev = "8e97688693ca47ea1055f3d15055a4f4ecc5c832";
163       hash = "sha256-tx5Y819rNDxOpjg3B/Y2lPcqJDArAxVwjbYarVmJ79k=";
164     };
165   };
167   checkTarget = "test";
168   postCheck = "unset NEOMUTT_TEST_DIR";
170   meta = {
171     description = "Small but very powerful text-based mail client";
172     mainProgram = "neomutt";
173     homepage = "https://www.neomutt.org";
174     license = lib.licenses.gpl2Plus;
175     maintainers = with lib.maintainers; [
176       erikryb
177       raitobezarius
178     ];
179     platforms = lib.platforms.unix;
180   };