Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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}: 14 15let 16 opentelemetry-proto = fetchFromGitHub { 17 owner = "open-telemetry"; 18 repo = "opentelemetry-proto"; 19 rev = "v1.3.2"; 20 hash = "sha256-bkVqPSVhyMHrmFvlI9DTAloZzDozj3sefIEwfW7OVrI="; 21 }; 22in 23stdenv.mkDerivation (finalAttrs: { 24 pname = "opentelemetry-cpp"; 25 version = "1.16.1"; 26 27 src = fetchFromGitHub { 28 owner = "open-telemetry"; 29 repo = "opentelemetry-cpp"; 30 rev = "v${finalAttrs.version}"; 31 hash = "sha256-31zwIZ4oehhfn+oCyg8VQTurPOmdgp72plH1Pf/9UKQ="; 32 }; 33 34 patches = [ 35 ./0001-Disable-tests-requiring-network-access.patch 36 ] 37 ++ lib.optional stdenv.hostPlatform.isDarwin ./0002-Disable-segfaulting-test-on-Darwin.patch; 38 39 nativeBuildInputs = [ cmake ]; 40 41 buildInputs = [ 42 curl 43 grpc 44 nlohmann_json 45 prometheus-cpp 46 protobuf 47 ]; 48 49 doCheck = true; 50 51 checkInputs = [ 52 gtest 53 ]; 54 55 strictDeps = true; 56 57 cmakeFlags = [ 58 "-DBUILD_SHARED_LIBS=ON" 59 "-DWITH_OTLP_HTTP=ON" 60 "-DWITH_OTLP_GRPC=ON" 61 "-DWITH_ABSEIL=ON" 62 "-DWITH_PROMETHEUS=ON" 63 "-DWITH_ELASTICSEARCH=ON" 64 "-DWITH_ZIPKIN=ON" 65 "-DWITH_BENCHMARK=OFF" 66 "-DOTELCPP_PROTO_PATH=${opentelemetry-proto}" 67 ]; 68 69 outputs = [ 70 "out" 71 "dev" 72 ]; 73 74 postInstall = '' 75 substituteInPlace $out/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-target.cmake \ 76 --replace-fail "\''${_IMPORT_PREFIX}/include" "$dev/include" 77 ''; 78 79 passthru.updateScript = nix-update-script { }; 80 81 meta = { 82 description = "OpenTelemetry C++ Client Library"; 83 homepage = "https://github.com/open-telemetry/opentelemetry-cpp"; 84 license = [ lib.licenses.asl20 ]; 85 maintainers = with lib.maintainers; [ jfroche ]; 86 platforms = lib.platforms.linux; 87 # https://github.com/protocolbuffers/protobuf/issues/14492 88 broken = !(stdenv.buildPlatform.canExecute stdenv.hostPlatform); 89 }; 90})