Merge pull request #31207 from rnhmjoj/mutt-gpg

mutt: add option to configure S/MIME and GnuPG
This commit is contained in:
Joachim F 2017-11-22 04:08:10 +00:00 committed by GitHub
commit 7059c88290
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,12 +1,15 @@
{ stdenv, fetchurl, ncurses, which, perl { stdenv, fetchurl, fetchpatch, ncurses, which, perl
, gdbm ? null , gdbm ? null
, openssl ? null , openssl ? null
, cyrus_sasl ? null , cyrus_sasl ? null
, gnupg ? null
, gpgme ? null , gpgme ? null
, kerberos ? null , kerberos ? null
, headerCache ? true , headerCache ? true
, sslSupport ? true , sslSupport ? true
, saslSupport ? true , saslSupport ? true
, smimeSupport ? false
, gpgSupport ? false
, gpgmeSupport ? true , gpgmeSupport ? true
, imapSupport ? true , imapSupport ? true
, withSidebar ? true , withSidebar ? true
@ -16,7 +19,9 @@
assert headerCache -> gdbm != null; assert headerCache -> gdbm != null;
assert sslSupport -> openssl != null; assert sslSupport -> openssl != null;
assert saslSupport -> cyrus_sasl != null; assert saslSupport -> cyrus_sasl != null;
assert gpgmeSupport -> gpgme != null; assert smimeSupport -> openssl != null;
assert gpgSupport -> gnupg != null;
assert gpgmeSupport -> gpgme != null && openssl != null;
with stdenv.lib; with stdenv.lib;
@ -29,9 +34,10 @@ stdenv.mkDerivation rec {
sha256 = "1c8vv4anl555a03pbnwf8wnf0d8pcnd4p35y3q8f5ikkcflq76vl"; sha256 = "1c8vv4anl555a03pbnwf8wnf0d8pcnd4p35y3q8f5ikkcflq76vl";
}; };
patchPhase = optionalString (openssl != null) '' patches = optional smimeSupport (fetchpatch {
sed -i 's#/usr/bin/openssl#${openssl}/bin/openssl#' smime_keys.pl url = "https://sources.debian.net/src/mutt/1.7.2-1/debian/patches/misc/smime.rc.patch";
''; sha256 = "0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73";
});
buildInputs = buildInputs =
[ ncurses which perl ] [ ncurses which perl ]
@ -64,6 +70,22 @@ stdenv.mkDerivation rec {
++ optional gssSupport "--with-gss" ++ optional gssSupport "--with-gss"
++ optional saslSupport "--with-sasl"; ++ optional saslSupport "--with-sasl";
postPatch = optionalString (smimeSupport || gpgmeSupport) ''
sed -i 's#/usr/bin/openssl#${openssl}/bin/openssl#' smime_keys.pl
'';
postInstall = optionalString smimeSupport ''
# S/MIME setup
cp contrib/smime.rc $out/etc/smime.rc
sed -i 's#openssl#${openssl}/bin/openssl#' $out/etc/smime.rc
echo "source $out/etc/smime.rc" >> $out/etc/Muttrc
'' + optionalString gpgSupport ''
# GnuPG setup
cp contrib/gpg.rc $out/etc/gpg.rc
sed -i 's#\(command="\)gpg #\1${gnupg}/bin/gpg #' $out/etc/gpg.rc
echo "source $out/etc/gpg.rc" >> $out/etc/Muttrc
'';
meta = { meta = {
description = "A small but very powerful text-based mail client"; description = "A small but very powerful text-based mail client";
homepage = http://www.mutt.org; homepage = http://www.mutt.org;