1{ lib, buildPythonPackage, python, fetchFromGitHub, isPy3k, pytestCheckHook
2, notmuch2, urwid, urwidtrees, twisted, python_magic, configobj, mock, file, gpgme
3, service-identity, gnupg, sphinx, gawk, procps, future , withManpage ? false
4}:
5
6buildPythonPackage rec {
7 pname = "alot";
8 version = "0.10";
9 outputs = [ "out" ] ++ lib.optional withManpage "man";
10
11 disabled = !isPy3k;
12
13 src = fetchFromGitHub {
14 owner = "pazz";
15 repo = "alot";
16 rev = version;
17 sha256 = "sha256-1reAq8X9VwaaZDY5UfvcFzHDKd71J88CqJgH3+ANjis=";
18 };
19
20 postPatch = ''
21 substituteInPlace alot/settings/manager.py --replace /usr/share "$out/share"
22 '';
23
24 nativeBuildInputs = lib.optional withManpage sphinx;
25
26 propagatedBuildInputs = [
27 notmuch2
28 urwid
29 urwidtrees
30 twisted
31 python_magic
32 configobj
33 service-identity
34 file
35 gpgme
36 ];
37
38 postBuild = lib.optionalString withManpage "make -C docs man";
39
40 checkInputs = [ gawk future mock gnupg procps pytestCheckHook ];
41 # some twisted tests need internet access
42 disabledTests = [
43 "test_env_set"
44 "test_no_spawn_no_stdin_attached"
45 ];
46
47 postInstall = let
48 completionPython = python.withPackages (ps: [ ps.configobj ]);
49 in lib.optionalString withManpage ''
50 mkdir -p $out/man
51 cp -r docs/build/man $out/man
52 ''
53 + ''
54 mkdir -p $out/share/{applications,alot}
55 cp -r extra/themes $out/share/alot
56
57 substituteInPlace extra/completion/alot-completion.zsh \
58 --replace "python3" "${completionPython.interpreter}"
59 install -D extra/completion/alot-completion.zsh $out/share/zsh/site-functions/_alot
60
61 sed "s,/usr/bin,$out/bin,g" extra/alot.desktop > $out/share/applications/alot.desktop
62 '';
63
64 meta = with lib; {
65 homepage = "https://github.com/pazz/alot";
66 description = "Terminal MUA using notmuch mail";
67 license = licenses.gpl3Plus;
68 platforms = platforms.linux;
69 maintainers = with maintainers; [ edibopp ];
70 };
71}