1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 cmake, 7 abseil-cpp, 8 protobuf_29, 9 pybind11, 10 zlib, 11}: 12 13buildPythonPackage { 14 pname = "pybind11-protobuf"; 15 version = "0-unstable-2025-02-10"; 16 pyproject = false; 17 18 src = fetchFromGitHub { 19 owner = "pybind"; 20 repo = "pybind11_protobuf"; 21 rev = "f02a2b7653bc50eb5119d125842a3870db95d251"; 22 hash = "sha256-jlZcxQKYYYvTOGhk+0Sgtek4oKy6R1wDGiBOf2t+KiU="; 23 }; 24 25 patches = [ 26 # Rebase of the OpenSUSE patch: https://build.opensuse.org/projects/openSUSE:Factory/packages/pybind11_protobuf/files/0006-Add-install-target-for-CMake-builds.patch?expand=1 27 # on top of: https://github.com/pybind/pybind11_protobuf/pull/188/commits/5f0ac3d8c10cbb8b3b81063467c71085cd39624f 28 ./add-install-target-for-cmake-builds.patch 29 ]; 30 31 nativeBuildInputs = [ cmake ]; 32 33 buildInputs = [ 34 abseil-cpp 35 protobuf_29 36 pybind11 37 zlib 38 ]; 39 40 cmakeFlags = 41 [ 42 (lib.cmakeBool "USE_SYSTEM_ABSEIL" true) 43 (lib.cmakeBool "USE_SYSTEM_PROTOBUF" true) 44 (lib.cmakeBool "USE_SYSTEM_PYBIND" true) 45 46 # The find_package calls are local to the dependencies subdirectory 47 (lib.cmakeBool "CMAKE_FIND_PACKAGE_TARGETS_GLOBAL" true) 48 ] 49 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 50 # Without it, Cmake prefers using Find-module which is mysteriously broken 51 # But the generated Config works 52 (lib.cmakeBool "CMAKE_FIND_PACKAGE_PREFER_CONFIG" true) 53 ]; 54 55 meta = { 56 description = "Pybind11 bindings for Google's Protocol Buffers"; 57 homepage = "https://github.com/pybind/pybind11_protobuf"; 58 license = lib.licenses.bsd3; 59 maintainers = with lib.maintainers; [ wegank ]; 60 }; 61}