nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6}:
7
8stdenv.mkDerivation (finalAttrs: {
9 pname = "prometheus-cpp-lite";
10 version = "1.0-unstable-2023-08-13";
11
12 src = fetchFromGitHub {
13 owner = "biaks";
14 repo = "prometheus-cpp-lite";
15 rev = "48d09c45ee6deb90e02579b03037740e1c01fd27";
16 hash = "sha256-XplbP4wHxK9z8Q5fOnaiL7vzXBaZTJyo/tmXUJN/mb4=";
17 };
18
19 patches = [
20 ./missing_includes.patch
21 ];
22
23 postPatch = ''
24 for dir in . core simpleapi; do
25 substituteInPlace $dir/CMakeLists.txt --replace-fail \
26 'cmake_minimum_required(VERSION 3.2)' \
27 'cmake_minimum_required(VERSION 3.10)'
28 done
29
30 substituteInPlace 3rdpatry/http-client-lite/CMakeLists.txt --replace-fail \
31 'cmake_minimum_required(VERSION 3.3 FATAL_ERROR)' \
32 'cmake_minimum_required(VERSION 3.10)' \
33 '';
34
35 nativeBuildInputs = [
36 cmake
37 ];
38
39 installPhase = ''
40 runHook preInstall
41
42 mkdir -p $out/include/prometheus $out/lib
43
44 cp ../core/include/prometheus/* $out/include/prometheus
45 cp ../simpleapi/include/prometheus/* $out/include/prometheus
46 cp simpleapi/libprometheus-cpp-simpleapi.* $out/lib/
47
48 runHook postInstall
49 '';
50
51 meta = {
52 description = "C++ Header-only Prometheus client library";
53 homepage = "https://github.com/biaks/prometheus-cpp-lite";
54 maintainers = [ lib.maintainers.markuskowa ];
55 license = lib.licenses.mit;
56 platforms = lib.platforms.linux;
57 };
58})