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