How do I add include path for header only libraries installed from github?

Im trying to install this header only library: GitHub - biaks/prometheus-cpp-lite: C++ header-only prometheus client library for quickly and easily adding metric (and profiling) functionality to C++ projects.

In my flake.nix I have:
prometheus.url = “github:biaks/prometheus-cpp-lite”;
prometheus.flake = false;

When I run nix develop, I see prometheus in the /nix/store.
However, it’s not part of CMAKE_INCLUDE_PATH. How do I add it?

Hi, did you find this out?

The CMAKE_INCLUDE_PATH is empty by default and it is something you would need to set yourself. To pass prometheus’s store path to cmake you could store it to an environment variable first and then pass it forward to cmake.

Assuming you use mkShell:

  outputs = { nixpkgs, prometheus, ... }: let
    pkgs = nixpkgs.legacyPackages.x86_64-linux;
  in {
    devShells.x86_64-linux.default = pkgs.mkShell {
       packages = [ pkgs.cmake ];
       env.PROMETHEUS_DIR = "${prometheus}";
    };
  }

Then, within the dev shell:

cmake -DCMAKE_INCLUDE_PATH=$PROMETHEUS_DIR ...