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.1";
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 = "0s94m17yph1gq9f2svipb3bbwbw1s4j3zf2xkg5h91006v8286r6";
20 };
21
22 postPatch = ''
23 substituteInPlace alot/settings/manager.py --replace /usr/share "$out/share"
24 '';
25
26 nativeBuildInputs = lib.optional withManpage sphinx;
27
28 propagatedBuildInputs = [
29 notmuch
30 urwid
31 urwidtrees
32 twisted
33 python_magic
34 configobj
35 service-identity
36 file
37 gpgme
38 ];
39
40 # some twisted tests need the network (test_env_set... )
41 doCheck = false;
42 postBuild = lib.optionalString withManpage "make -C docs man";
43
44 checkInputs = [ awk future mock gnupg procps ];
45
46 postInstall = let
47 completionPython = python.withPackages (ps: [ ps.configobj ]);
48 in lib.optionalString withManpage ''
49 mkdir -p $out/man
50 cp -r docs/build/man $out/man
51 ''
52 + ''
53 mkdir -p $out/share/{applications,alot}
54 cp -r extra/themes $out/share/alot
55
56 substituteInPlace extra/completion/alot-completion.zsh \
57 --replace "python3" "${completionPython.interpreter}"
58 install -D extra/completion/alot-completion.zsh $out/share/zsh/site-functions/_alot
59
60 sed "s,/usr/bin,$out/bin,g" extra/alot.desktop > $out/share/applications/alot.desktop
61 '';
62
63 meta = with stdenv.lib; {
64 homepage = "https://github.com/pazz/alot";
65 description = "Terminal MUA using notmuch mail";
66 license = licenses.gpl3;
67 platforms = platforms.linux;
68 maintainers = with maintainers; [ edibopp ];
69 };
70}