about summary refs log tree commit diff
path: root/pkgs/applications/networking/mailreaders/claws-mail/default.nix
blob: a198c355290a43f9d7ab57a01fd7bf0bb08c934b (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
{ stdenv, lib, fetchgit, wrapGAppsHook, autoreconfHook, bison, flex
, curl, gtk2, gtk3, pkg-config, python2, python3, shared-mime-info
, glib-networking, gsettings-desktop-schemas

# Use the experimental gtk3 branch.
, useGtk3 ? false

# Package compatibility: old parameters whose name were not directly derived
, enablePgp ? true
, enablePluginNotificationDialogs ? true
, enablePluginNotificationSounds ? true
, enablePluginPdf ? true
, enablePluginRavatar ? true
, enableSpellcheck ? true

# Arguments to include external libraries
, enableLibSM ? true, libSM
, enableGnuTLS ? true, gnutls
, enableEnchant ? enableSpellcheck, enchant
, enableDbus ? true, dbus, dbus-glib
, enableLdap ? true, openldap
, enableNetworkManager ? true, networkmanager
, enableLibetpan ? true, libetpan
, enableValgrind ? true, valgrind
, enableSvg ? true, librsvg

# Configure claws-mail's plugins
, enablePluginAcpiNotifier ? true
, enablePluginAddressKeeper ? true
, enablePluginArchive ? true, libarchive
, enablePluginAttRemover ? true
, enablePluginAttachWarner ? true
, enablePluginBogofilter ? true
, enablePluginBsfilter ? true
, enablePluginClamd ? true
, enablePluginDillo ? true
, enablePluginFetchInfo ? true
, enablePluginLibravatar ? enablePluginRavatar
, enablePluginLitehtmlViewer ? true, gumbo
, enablePluginMailmbox ? true
, enablePluginManageSieve ? true
, enablePluginNewMail ? true
, enablePluginNotification ? (enablePluginNotificationDialogs || enablePluginNotificationSounds), libcanberra-gtk2, libcanberra-gtk3, libnotify
, enablePluginPdfViewer ? enablePluginPdf, poppler
, enablePluginPerl ? true, perl
, enablePluginPython ? true
, enablePluginPgp ? enablePgp, gnupg, gpgme
, enablePluginRssyl ? true, libxml2
, enablePluginSmime ? true
, enablePluginSpamassassin ? true
, enablePluginSpamReport ? true
, enablePluginTnefParse ? true, libytnef
, enablePluginVcalendar ? true, libical
}:

with lib;

let
  version = "3.17.8";

  # The official release uses gtk2 and contains the version tag.
  gtk2src = {
    rev = version;
    sha256 = "0l4f8q11iyj8pi120lrapgq51k5j64xf0jlczkzbm99rym752ch5";
  };

  # The corresponding commit in the gtk3 branch.
  gtk3src = {
    rev = "3.99.0";
    sha256 = "176h1swh1zx6dqyzfz470x4a1xicnv0zhy8ir47k7p23g6y17i2k";
  };

  python = if useGtk3 then python3 else python2;
  pythonPkgs = if useGtk3
    then
      with python.pkgs; [ python wrapPython pygobject3 ]
    else
      with python.pkgs; [ python wrapPython pygtk pygobject2 ];
in stdenv.mkDerivation rec {
  pname = "claws-mail";
  inherit version;

  src = fetchgit ({
    url = "git://git.claws-mail.org/claws.git";
  } // (if useGtk3 then gtk3src else gtk2src));

  outputs = [ "out" "dev" ];

  patches = [ ./mime.patch ];

  preConfigure = ''
    # autotools check tries to dlopen libpython as a requirement for the python plugin
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${python}/lib
    # generate version without .git
    [ -e version ] || echo "echo ${version}" > version
  '';

  postPatch = ''
    substituteInPlace src/procmime.c \
        --subst-var-by MIMEROOTDIR ${shared-mime-info}/share
  '';

  nativeBuildInputs = [ autoreconfHook pkg-config bison flex wrapGAppsHook ];
  propagatedBuildInputs = pythonPkgs;

  buildInputs =
    [ curl gsettings-desktop-schemas glib-networking ]
    ++ [(if useGtk3 then gtk3 else gtk2)]
    ++ optional  enableLibSM libSM
    ++ optional  enableGnuTLS gnutls
    ++ optional  enableEnchant enchant
    ++ optionals enableDbus [ dbus dbus-glib ]
    ++ optional  enableLdap openldap
    ++ optional  enableNetworkManager networkmanager
    ++ optional  enableLibetpan libetpan
    ++ optional  enableValgrind valgrind
    ++ optional  enableSvg librsvg
    ++ optional  enablePluginArchive libarchive
    ++ optional  enablePluginLitehtmlViewer gumbo
    ++ optionals enablePluginNotification [ libnotify ] ++ [(if useGtk3 then libcanberra-gtk3 else libcanberra-gtk2)]
    ++ optional  enablePluginPerl perl
    ++ optional  enablePluginPdfViewer poppler
    ++ optional  enablePluginRssyl libxml2
    ++ optionals enablePluginPgp [ gnupg gpgme ]
    ++ optional  enablePluginTnefParse libytnef
    ++ optional  enablePluginVcalendar libical
  ;

  configureFlags =
    [
      "--disable-manual"   # Missing docbook-tools, e.g., docbook2html
      "--disable-compface" # Missing compface library
      "--disable-jpilot"   # Missing jpilot library

      "--disable-gdata-plugin" # Complains about missing libgdata, even when provided
      "--disable-fancy-plugin" # Missing libwebkit-1.0 library
    ]
    ++
    (map (e: strings.enableFeature (lists.head e) (lists.last e)) [
      [ enableLibSM "libsm" ]
      [ enableGnuTLS "gnutls" ]
      [ enableEnchant "enchant" ]
      [ enableDbus "dbus" ]
      [ enableLdap "ldap" ]
      [ enableNetworkManager "networkmanager" ]
      [ enableLibetpan "libetpan" ]
      [ enableValgrind "valgrind" ]
      [ enableSvg "svg" ]

      [ enablePluginAcpiNotifier "acpi_notifier-plugin" ]
      [ enablePluginAddressKeeper "address_keeper-plugin" ]
      [ enablePluginArchive "archive-plugin" ]
      [ enablePluginAttRemover "att_remover-plugin" ]
      [ enablePluginAttachWarner "attachwarner-plugin" ]
      [ enablePluginBogofilter "bogofilter-plugin" ]
      [ enablePluginBsfilter "bsfilter-plugin" ]
      [ enablePluginClamd "clamd-plugin" ]
      [ enablePluginDillo "dillo-plugin" ]
      [ enablePluginFetchInfo "fetchinfo-plugin" ]
      [ enablePluginLibravatar "libravatar-plugin" ]
      [ enablePluginLitehtmlViewer "litehtml_viewer-plugin" ]
      [ enablePluginMailmbox "mailmbox-plugin" ]
      [ enablePluginManageSieve "managesieve-plugin" ]
      [ enablePluginNewMail "newmail-plugin" ]
      [ enablePluginNotification "notification-plugin" ]
      [ enablePluginPdfViewer "pdf_viewer-plugin" ]
      [ enablePluginPerl "perl-plugin" ]
      [ enablePluginPython "python-plugin" ]
      [ enablePluginPgp "pgpcore-plugin" ]
      [ enablePluginPgp "pgpmime-plugin" ]
      [ enablePluginPgp "pgpinline-plugin" ]
      [ enablePluginRssyl "rssyl-plugin" ]
      [ enablePluginSmime "smime-plugin" ]
      [ enablePluginSpamassassin "spamassassin-plugin" ]
      [ enablePluginSpamReport "spam_report-plugin" ]
      [ enablePluginTnefParse "tnef_parse-plugin" ]
      [ enablePluginVcalendar "vcalendar-plugin" ]
    ]);

  enableParallelBuilding = true;

  preFixup = ''
    buildPythonPath "$out $pythonPkgs"
    gappsWrapperArgs+=(--prefix XDG_DATA_DIRS : "${shared-mime-info}/share" --prefix PYTHONPATH : "$program_PYTHONPATH")
  '';

  postInstall = ''
    mkdir -p $out/share/applications
    cp claws-mail.desktop $out/share/applications
  '';

  meta = {
    description = "The user-friendly, lightweight, and fast email client";
    homepage = "https://www.claws-mail.org/";
    license = licenses.gpl3;
    platforms = platforms.linux;
    maintainers = with maintainers; [ fpletz globin orivej oxzi ];
  };
}