nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 114 lines 3.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 cmake, 6 gtest, 7 protobuf, 8 curl, 9 grpc, 10 prometheus-cpp, 11 nlohmann_json, 12 nix-update-script, 13 cxxStandard ? null, 14 enableHttp ? false, 15 enableGrpc ? false, 16 enablePrometheus ? false, 17 enableElasticSearch ? false, 18 enableZipkin ? false, 19}: 20let 21 opentelemetry-proto = fetchFromGitHub { 22 owner = "open-telemetry"; 23 repo = "opentelemetry-proto"; 24 rev = "v1.8.0"; 25 hash = "sha256-5rNJDMjRFIOY/3j+PkAujbippBmxtAudU9busK0q8p0="; 26 }; 27in 28stdenv.mkDerivation (finalAttrs: { 29 pname = "opentelemetry-cpp"; 30 version = "1.24.0"; 31 32 src = fetchFromGitHub { 33 owner = "open-telemetry"; 34 repo = "opentelemetry-cpp"; 35 rev = "v${finalAttrs.version}"; 36 hash = "sha256-rVR8JWNoT5mxIgzynY8VzlZ4QxhWIEFBqogi+WFDcF0="; 37 }; 38 39 patches = [ 40 ./0001-Disable-tests-requiring-network-access.patch 41 ] 42 ++ lib.optional stdenv.hostPlatform.isDarwin ./0002-Disable-segfaulting-test-on-Darwin.patch; 43 44 nativeBuildInputs = [ cmake ]; 45 46 buildInputs = [ 47 curl 48 nlohmann_json 49 ]; 50 51 propagatedBuildInputs = 52 lib.optionals (enableGrpc || enableHttp) [ protobuf ] 53 ++ lib.optionals enableGrpc [ 54 grpc 55 ] 56 ++ lib.optionals enablePrometheus [ 57 prometheus-cpp 58 ]; 59 60 doCheck = true; 61 62 checkInputs = [ 63 gtest 64 ]; 65 66 strictDeps = true; 67 68 cmakeFlags = [ 69 (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) 70 (lib.cmakeBool "WITH_BENCHMARK" false) 71 (lib.cmakeBool "WITH_OTLP_HTTP" enableHttp) 72 (lib.cmakeBool "WITH_OTLP_GRPC" enableGrpc) 73 (lib.cmakeBool "WITH_PROMETHEUS" enablePrometheus) 74 (lib.cmakeBool "WITH_ELASTICSEARCH" enableElasticSearch) 75 (lib.cmakeBool "WITH_ZIPKIN" enableZipkin) 76 (lib.cmakeFeature "OTELCPP_PROTO_PATH" "${opentelemetry-proto}") 77 ] 78 ++ lib.optionals (cxxStandard != null) [ 79 (lib.cmakeFeature "CMAKE_CXX_STANDARD" cxxStandard) 80 (lib.cmakeFeature "WITH_STL" "CXX${cxxStandard}") 81 ]; 82 83 outputs = [ 84 "out" 85 "dev" 86 ]; 87 88 # "--replace-fail" would normally be preferred, since it is better at 89 # highlighting obsolete/uneeded substitutions, but in this case 90 # "--replace-quiet" must be used. 91 # substituteInPlace with "--replace-fail" already fails if there is no 92 # substitution in at least one of the specified files. Below is applied to 93 # multiple files where some but not all of them match the substitution 94 # strings. 95 postInstall = '' 96 substituteInPlace $out/lib/cmake/opentelemetry-cpp/opentelemetry-cpp*-target.cmake \ 97 --replace-quiet "\''${_IMPORT_PREFIX}/include" "$dev/include" 98 ''; 99 100 passthru.updateScript = nix-update-script { }; 101 102 meta = { 103 description = "OpenTelemetry C++ Client Library"; 104 homepage = "https://github.com/open-telemetry/opentelemetry-cpp"; 105 license = [ lib.licenses.asl20 ]; 106 maintainers = with lib.maintainers; [ 107 jfroche 108 panicgh 109 ]; 110 platforms = lib.platforms.all; 111 # https://github.com/protocolbuffers/protobuf/issues/14492 112 broken = !(stdenv.buildPlatform.canExecute stdenv.hostPlatform); 113 }; 114})