1{ stdenv, lib, buildPythonPackage, python, fetchFromGitHub, fetchpatch, isPy3k
2, notmuch, urwid, urwidtrees, twisted, python_magic, configobj, mock, file, gpgme
3, service-identity
4, gnupg ? null, sphinx, awk ? null, procps ? null, future ? null
5, withManpage ? false }:
6
7
8buildPythonPackage rec {
9 pname = "alot";
10 version = "0.9";
11 outputs = [ "out" ] ++ lib.optional withManpage "man";
12
13 disabled = !isPy3k;
14
15 src = fetchFromGitHub {
16 owner = "pazz";
17 repo = "alot";
18 rev = version;
19 sha256 = "sha256-WUwOJcq8JE7YO8sFeZwYikCRhpufO0pL6MKu54ZYsHI=";
20 };
21
22 patches = [
23 # can't compose email if signature is set: https://github.com/pazz/alot/issues/1468
24 (fetchpatch {
25 name = "envelope-body.patch";
26 url = "https://github.com/pazz/alot/commit/28a4296c7f556c251d71d9502681980d46d9fa55.patch";
27 sha256 = "1iwvmjyz4mh1g08vr85ywhah2xarcqg8dazagygk19icgsn45w06";
28 })
29 ];
30
31 nativeBuildInputs = lib.optional withManpage sphinx;
32
33 propagatedBuildInputs = [
34 notmuch
35 urwid
36 urwidtrees
37 twisted
38 python_magic
39 configobj
40 service-identity
41 file
42 gpgme
43 ];
44
45 # some twisted tests need the network (test_env_set... )
46 doCheck = false;
47 postBuild = lib.optionalString withManpage "make -C docs man";
48
49 checkInputs = [ awk future mock gnupg procps ];
50
51 postInstall = let
52 completionPython = python.withPackages (ps: [ ps.configobj ]);
53 in lib.optionalString withManpage ''
54 mkdir -p $out/man
55 cp -r docs/build/man $out/man
56 ''
57 + ''
58 mkdir -p $out/share/{applications,alot}
59 cp -r extra/themes $out/share/alot
60
61 substituteInPlace extra/completion/alot-completion.zsh \
62 --replace "python3" "${completionPython.interpreter}"
63 install -D extra/completion/alot-completion.zsh $out/share/zsh/site-functions/_alot
64
65 sed "s,/usr/bin,$out/bin,g" extra/alot.desktop > $out/share/applications/alot.desktop
66 '';
67
68 meta = with stdenv.lib; {
69 homepage = https://github.com/pazz/alot;
70 description = "Terminal MUA using notmuch mail";
71 license = licenses.gpl3;
72 platforms = platforms.linux;
73 maintainers = with maintainers; [ geistesk ];
74 };
75}