base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / al / alot / package.nix
blobcf0de377e370be22a37086f8e0dd046473df5c0a
1 { lib
2 , python311
3 , fetchFromGitHub
4 , file
5 , gnupg
6 , gawk
7 , procps
8 , notmuch
9 , withManpage ? false
12 with python311.pkgs; buildPythonApplication rec {
13   pname = "alot";
14   version = "0.11";
15   pyproject = true;
17   outputs = [
18     "out"
19   ] ++ lib.optionals withManpage [
20     "man"
21   ];
23   disabled = !isPy3k;
25   src = fetchFromGitHub {
26     owner = "pazz";
27     repo = "alot";
28     rev = "refs/tags/${version}";
29     sha256 = "sha256-mXaRzl7260uxio/BQ36BCBxgKhl1r0Rc6PwFZA8qNqc=";
30   };
32   postPatch = ''
33     substituteInPlace alot/settings/manager.py \
34       --replace-fail /usr/share "$out/share"
35   '';
37   nativeBuildInputs = [
38     setuptools-scm
39   ] ++ lib.optional withManpage sphinx;
41   propagatedBuildInputs = [
42     configobj
43     file
44     gpgme
45     notmuch2
46     python-magic
47     service-identity
48     twisted
49     urwid
50     urwidtrees
51   ];
53   nativeCheckInputs = [
54     future
55     gawk
56     gnupg
57     mock
58     procps
59     pytestCheckHook
60     notmuch
61   ];
63   postBuild = lib.optionalString withManpage [
64     "make -C docs man"
65   ];
67   disabledTests = [
68     # Some twisted tests need internet access
69     "test_env_set"
70     "test_no_spawn_no_stdin_attached"
71     # DatabaseLockedError
72     "test_save_named_query"
73   ];
75   postInstall =
76     let
77       completionPython = python.withPackages (ps: [ ps.configobj ]);
78     in
79     lib.optionalString withManpage ''
80       mkdir -p $out/man
81       cp -r docs/build/man $out/man
82     ''
83     + ''
84       mkdir -p $out/share/{applications,alot}
85       cp -r extra/themes $out/share/alot
87       substituteInPlace extra/completion/alot-completion.zsh \
88         --replace-fail "python3" "${completionPython.interpreter}"
89       install -D extra/completion/alot-completion.zsh $out/share/zsh/site-functions/_alot
91       sed "s,/usr/bin,$out/bin,g" extra/alot.desktop > $out/share/applications/alot.desktop
92     '';
94   meta = with lib; {
95     homepage = "https://github.com/pazz/alot";
96     description = "Terminal MUA using notmuch mail";
97     mainProgram = "alot";
98     license = licenses.gpl3Plus;
99     platforms = platforms.linux;
100     maintainers = with maintainers; [ milibopp ];
101   };