1{ lib, stdenv
2, fetchFromGitHub
3, cmake
4, gbenchmark
5, gtest
6, civetweb
7, zlib
8, curl
9}:
10
11stdenv.mkDerivation rec {
12 pname = "prometheus-cpp";
13 version = "0.9.0";
14
15 src = fetchFromGitHub {
16 owner = "jupp0r";
17 repo = pname;
18 rev = "v${version}";
19 sha256 = "1pjz29ywzfg3blhg2v8fn7gjvq46k3bqn7y0xvmn468ixxhv21fi";
20 };
21
22 nativeBuildInputs = [ cmake ];
23 buildInputs = [ gbenchmark civetweb gtest zlib curl ];
24
25 strictDeps = true;
26
27 cmakeFlags = [
28 "-DUSE_THIRDPARTY_LIBRARIES=OFF"
29 "-DCIVETWEB_INCLUDE_DIR=${civetweb.dev}/include"
30 "-DCIVETWEB_CXX_LIBRARY=${civetweb}/lib/libcivetweb${stdenv.targetPlatform.extensions.sharedLibrary}"
31 "-DBUILD_SHARED_LIBS=ON"
32 ];
33
34 NIX_LDFLAGS = "-ldl";
35
36 postInstall = ''
37 mkdir -p $out/lib/pkgconfig
38 substituteAll ${./prometheus-cpp.pc.in} $out/lib/pkgconfig/prometheus-cpp.pc
39 '';
40
41 meta = {
42 description = "Prometheus Client Library for Modern C++";
43 homepage = "https://github.com/jupp0r/prometheus-cpp";
44 license = [ lib.licenses.mit ];
45 };
46
47}