diff --git a/pkgs/development/libraries/libpulsar/default.nix b/pkgs/development/libraries/libpulsar/default.nix index d87ef2b72802..56132920147a 100644 --- a/pkgs/development/libraries/libpulsar/default.nix +++ b/pkgs/development/libraries/libpulsar/default.nix @@ -1,10 +1,7 @@ { lib -, clang-tools -, llvmPackages -, boost179 -, protobuf -, python3Support ? false -, python3 +, asioSupport ? true +, asio +, boost180 , log4cxxSupport ? false , log4cxx , snappySupport ? false @@ -17,7 +14,8 @@ , gtestSupport ? false , cmake , curl -, fetchurl +, fetchFromGitHub +, protobuf , jsoncpp , openssl , pkg-config @@ -37,48 +35,39 @@ let */ enableCmakeFeature = p: if (p == null || p == false) then "OFF" else "ON"; - # Not really sure why I need to do this.. If I call clang-tools without the override it defaults to a different version and fails - clangTools = clang-tools.override { inherit stdenv llvmPackages; }; - # If boost has python enabled, then boost-python package will be installed which is used by libpulsars python wrapper - boost = if python3Support then boost179.override { inherit stdenv; enablePython = python3Support; python = python3; } else boost179; - defaultOptionals = [ boost protobuf ] - ++ lib.optional python3Support python3 + defaultOptionals = [ protobuf ] ++ lib.optional snappySupport snappy.dev ++ lib.optional zlibSupport zlib ++ lib.optional zstdSupport zstd - ++ lib.optional log4cxxSupport log4cxx; + ++ lib.optional log4cxxSupport log4cxx + ++ lib.optional asioSupport asio + ++ lib.optional (!asioSupport) boost180; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: rec { pname = "libpulsar"; - version = "2.10.2"; + version = "3.5.0"; - src = fetchurl { - hash = "sha256-IONnsSDbnX2qz+Xya0taHYSViTOiRI36AfcxmY3dNpo="; - url = "mirror://apache/pulsar/pulsar-${version}/apache-pulsar-${version}-src.tar.gz"; + src = fetchFromGitHub { + owner = "apache"; + repo = "pulsar-client-cpp"; + rev = "v${version}"; + hash = "sha256-pNeoStDryyMtBolpp5nT5GFjYPuXg2ks1Ka1mjjN/9k="; }; - sourceRoot = "apache-pulsar-${version}-src/pulsar-client-cpp"; - - # clang-tools needed for clang-format - nativeBuildInputs = [ cmake pkg-config clangTools ] + nativeBuildInputs = [ cmake pkg-config ] ++ defaultOptionals ++ lib.optional gtestSupport gtest.dev; buildInputs = [ jsoncpp openssl curl ] ++ defaultOptionals; - # Needed for GCC on Linux - env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error=return-type" ]; - cmakeFlags = [ "-DBUILD_TESTS=${enableCmakeFeature gtestSupport}" - "-DBUILD_PYTHON_WRAPPER=${enableCmakeFeature python3Support}" "-DUSE_LOG4CXX=${enableCmakeFeature log4cxxSupport}" - "-DClangTools_PATH=${clangTools}/bin" + "-DUSE_ASIO=${enableCmakeFeature asioSupport}" ]; - enableParallelBuilding = true; doInstallCheck = true; installCheckPhase = '' echo ${lib.escapeShellArg '' @@ -92,11 +81,11 @@ stdenv.mkDerivation rec { ''; meta = with lib; { - homepage = "https://pulsar.apache.org/docs/en/client-libraries-cpp"; + homepage = "https://pulsar.apache.org/docs/next/client-libraries-cpp/"; description = "Apache Pulsar C++ library"; - + changelog = "https://github.com/apache/pulsar-client-cpp/releases/tag/v${version}"; platforms = platforms.all; license = licenses.asl20; - maintainers = [ maintainers.corbanr ]; + maintainers = with maintainers; [ corbanr gaelreyrol ]; }; -} +}) diff --git a/pkgs/development/python-modules/pulsar/default.nix b/pkgs/development/python-modules/pulsar/default.nix new file mode 100644 index 000000000000..472b9cb0527a --- /dev/null +++ b/pkgs/development/python-modules/pulsar/default.nix @@ -0,0 +1,60 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pythonOlder +, cmake +, pkg-config +, libpulsar +, pybind11 +, certifi +}: + +buildPythonPackage rec { + pname = "pulsar"; + version = "3.4.0"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "apache"; + repo = "pulsar-client-python"; + rev = "v${version}"; + hash = "sha256-WcD88s8V4AT/juW0qmYHdtYzrS3hWeom/4r8TETlmFE="; + }; + + disabled = pythonOlder "3.7"; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + buildInputs = [ + libpulsar + pybind11 + ]; + + preBuild = '' + make -j$NIX_BUILD_CORES + make install + cd .. + ''; + + propagatedBuildInputs = [ + certifi + ]; + + # Requires to setup a cluster + doCheck = false; + + pythonImportsCheck = [ + "pulsar" + ]; + + meta = with lib; { + description = "Apache Pulsar Python client library"; + homepage = "https://pulsar.apache.org/docs/next/client-libraries-python/"; + changelog = "https://github.com/apache/pulsar-client-python/releases/tag/v${version}"; + license = licenses.asl20; + maintainers = with maintainers; [ gaelreyrol ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 810868a51b69..541bc2d28fd1 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10299,6 +10299,8 @@ self: super: with self; { pulsectl-asyncio = callPackage ../development/python-modules/pulsectl-asyncio { }; + pulsar = callPackage ../development/python-modules/pulsar { }; + pulsectl = callPackage ../development/python-modules/pulsectl { }; pure-cdb = callPackage ../development/python-modules/pure-cdb { };