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