about summary refs log tree commit diff
path: root/pkgs/applications/networking/mailreaders/mutt/default.nix
blob: 0be5e0bd57eb0a7b0fe92d7853f295d13f4cf993 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{ stdenv, fetchurl, fetchpatch, ncurses, which, perl, autoreconfHook
, gdbm ? null
, openssl ? null
, cyrus_sasl ? null
, gpgme ? null
, aclocal ? null
, headerCache  ? true
, sslSupport   ? true
, saslSupport  ? true
, gpgmeSupport ? true
, imapSupport  ? true
, withSidebar  ? false
, withTrash    ? false
}:

assert headerCache  -> gdbm       != null;
assert sslSupport   -> openssl    != null;
assert saslSupport  -> cyrus_sasl != null;
assert gpgmeSupport -> gpgme      != null;

with stdenv.lib;

stdenv.mkDerivation rec {
  name = "mutt-${version}";
  version = "1.6.2";

  src = fetchurl {
    url = "http://ftp.mutt.org/pub/mutt/${name}.tar.gz";
    sha256 = "13hxmji7v9m2agmvzrs7gzx8s3c9jiwrv7pbkr7z1kc6ckq2xl65";
  };

  buildInputs =
    [ ncurses which perl ]
    ++ optional headerCache  gdbm
    ++ optional sslSupport   openssl
    ++ optional saslSupport  cyrus_sasl
    ++ optional gpgmeSupport gpgme
    ++ optional withSidebar  autoreconfHook;

  configureFlags = [
    (enableFeature headerCache  "hcache")
    (enableFeature gpgmeSupport "gpgme")
    (enableFeature imapSupport  "imap")
    (enableFeature withSidebar  "sidebar")
    "--enable-smtp"
    "--enable-pop"
    "--enable-imap"
    "--with-mailpath="

    # Look in $PATH at runtime, instead of hardcoding /usr/bin/sendmail
    "ac_cv_path_SENDMAIL=sendmail"

    # This allows calls with "-d N", that output debug info into ~/.muttdebug*
    "--enable-debug"

    # The next allows building mutt without having anything setgid
    # set by the installer, and removing the need for the group 'mail'
    # I set the value 'mailbox' because it is a default in the configure script
    "--with-homespool=mailbox"
  ] ++ optional sslSupport  "--with-ssl"
    ++ optional saslSupport "--with-sasl";

  patches =
    optional withTrash (fetchpatch {
      name = "trash.patch";
      url = "https://aur.archlinux.org/cgit/aur.git/plain/trash.patch?h=mutt-sidebar";
      sha256 = "1hrib9jk28mqd02nzv0sx01jfdabzvnwcc5qjc3810zfglzc1nql";
    }) ++
    optional withSidebar (fetchpatch {
      name = "sidebar.patch";
      url = "https://aur.archlinux.org/cgit/aur.git/plain/sidebar.patch?h=mutt-sidebar";
      sha256 = "1l63wj7kw41jrh00mcxdw4p4vrbc9wld42s99liw8kz2aclymq5m";
    });

  meta = {
    description = "A small but very powerful text-based mail client";
    homepage = http://www.mutt.org;
    license = licenses.gpl2Plus;
    platforms = platforms.unix;
    maintainers = with maintainers; [ the-kenny rnhmjoj ];
  };
}