1{
2 lib,
3 buildPythonPackage,
4 notmuch,
5 python,
6 cffi,
7}:
8
9buildPythonPackage {
10 pname = "notmuch2";
11 format = "setuptools";
12 inherit (notmuch) version src;
13
14 sourceRoot = "notmuch-${notmuch.version}/bindings/python-cffi";
15
16 nativeBuildInputs = [ cffi ];
17 buildInputs = [
18 python
19 notmuch
20 ];
21
22 propagatedBuildInputs = [ cffi ];
23
24 # since notmuch 0.35, this package expects _notmuch_config.py that is
25 # generated by notmuch's configure script. We write one which references our
26 # built libraries.
27 postPatch = ''
28 cat > _notmuch_config.py << EOF
29 import os
30 dir_path = os.path.dirname(os.path.realpath(__file__))
31 NOTMUCH_VERSION_FILE=os.path.join(dir_path, '../../version.txt')
32 NOTMUCH_INCLUDE_DIR='${notmuch.out}/lib'
33 NOTMUCH_LIB_DIR='${notmuch.out}/lib'
34 EOF
35 '';
36
37 # no tests
38 doCheck = false;
39 pythonImportsCheck = [ "notmuch2" ];
40
41 meta = with lib; {
42 description = "Pythonic bindings for the notmuch mail database using CFFI";
43 homepage = "https://notmuchmail.org/";
44 license = licenses.gpl3;
45 maintainers = with maintainers; [ teto ];
46 };
47}