linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / libraries / prometheus-client-c / default.nix
blob9b18b25c72684f9bb5622c3d70b8fa9fef62c2d3
1 { lib, stdenv
2 , fetchFromGitHub
3 , fetchpatch
4 , cmake
5 , libmicrohttpd
6 }:
7 let
8   build =
9     { pname
10     , subdir
11     , buildInputs ? [ ]
12     , description
13     }:
14     stdenv.mkDerivation rec {
15       inherit pname;
16       version = "0.1.1";
18       src = fetchFromGitHub {
19         owner = "digitalocean";
20         repo = "prometheus-client-c";
21         rev = "v${version}";
22         sha256 = "0g69s24xwrv5974acshrhnp6i8rpby8c6bhz15m3d8kpgjw3cm8f";
23       };
25       nativeBuildInputs = [ cmake ];
26       inherit buildInputs;
28       # These patches will be in 0.1.2
29       patches = [
30         # Required so CMAKE_INSTALL_PREFIX is honored, otherwise it
31         # installs headers in /usr/include (absolute)
32         (
33           fetchpatch {
34             url = "https://github.com/digitalocean/prometheus-client-c/commit/5fcedeb506b7d47dd7bab35797f2c3f23db6fe10.patch";
35             sha256 = "10hzg8v5jcgxz224kdq0nha9vs78wz098b0ys7gig2iwgrg018fy";
36           }
37         )
38         (
39           fetchpatch {
40             url = "https://github.com/digitalocean/prometheus-client-c/commit/0c15e7e45ad0c3726593591fdd7d8f2fde845fe3.patch";
41             sha256 = "06899v1xz3lpsdxww4p3q7pv8nrymnibncdc472056znr5fidlp0";
42           }
43         )
44       ];
46       preConfigure = ''
47         cd ${subdir}
48       '';
50       meta = {
51         homepage = "https://github.com/digitalocean/prometheus-client-c/";
52         inherit description;
53         platforms = lib.platforms.unix;
54         license = lib.licenses.asl20;
55         maintainers = [ lib.maintainers.cfsmp3 ];
56       };
57     };
59 rec {
60   libprom = build {
61     pname = "libprom";
62     subdir = "prom";
63     description = "A Prometheus Client in C";
64   };
65   libpromhttp = build {
66     pname = "libpromhttp";
67     subdir = "promhttp";
68     buildInputs = [ libmicrohttpd libprom ];
69     description = "A Prometheus HTTP Endpoint in C";
70   };