Instead of using the configure generated _notmuch_config.py, we generate our own which correctly references each respective field. The _notmuch_config.py in notmuch.bindingconfig contained references to the build directory. On linux this didn't break anything due to the sandbox always having a build root of /build. But on darwin this would be different depending on the derivation being built. So the build accidently worked since version.txt would end up in the same place on linux. It seems in practice NOTMUCH_LIB_DIR not containing the built libraries did not break the build. Either way after this commit it will point to the correct place. For convenience the _notmuch_config.py from notmuch.bindingconfig is viewable here https://gist.github.com/keegancsmith/bdc2f0e44425ad68c8b6a85f8ed0b289 We do not remove the bindingconfig output from notmuch in this commit since in my local testing that just caused cache invalidations on notmuch. But can do that as well.
46 lines
1 KiB
Nix
46 lines
1 KiB
Nix
{ stdenv
|
|
, lib
|
|
, buildPythonPackage
|
|
, notmuch
|
|
, python
|
|
, cffi
|
|
}:
|
|
|
|
buildPythonPackage {
|
|
pname = "notmuch2";
|
|
inherit (notmuch) version src;
|
|
|
|
sourceRoot = "notmuch-${notmuch.version}/bindings/python-cffi";
|
|
|
|
nativeBuildInputs = [
|
|
cffi
|
|
];
|
|
buildInputs = [
|
|
python notmuch cffi
|
|
];
|
|
|
|
# since notmuch 0.35, this package expects _notmuch_config.py that is
|
|
# generated by notmuch's configure script. We write one which references our
|
|
# built libraries.
|
|
postPatch = ''
|
|
cat > _notmuch_config.py << EOF
|
|
import os
|
|
dir_path = os.path.dirname(os.path.realpath(__file__))
|
|
NOTMUCH_VERSION_FILE=os.path.join(dir_path, '../../version.txt')
|
|
NOTMUCH_INCLUDE_DIR='${notmuch.out}/lib'
|
|
NOTMUCH_LIB_DIR='${notmuch.out}/lib'
|
|
EOF
|
|
'';
|
|
|
|
# no tests
|
|
doCheck = false;
|
|
pythonImportsCheck = [ "notmuch2" ];
|
|
|
|
meta = with lib; {
|
|
description = "Pythonic bindings for the notmuch mail database using CFFI";
|
|
homepage = "https://notmuchmail.org/";
|
|
license = licenses.gpl3;
|
|
maintainers = with maintainers; [ teto ];
|
|
};
|
|
}
|