C++ package

Let's package the following app: https://github.com/krupkat/microbench_test in a bench.nix file

{ stdenv
, cmake
, boost
, gbenchmark
, fetchurl
}:

stdenv.mkDerivation rec {
  pname = "microbench_test";
  version = "0.0.2";

  src = fetchurl {
    url = "https://github.com/krupkat/${pname}/archive/refs/tags/${version}.tar.gz";
    sha256 = "0gzzi3bg4yrlcmimjib2hz6r5djk5v3y7a0azcpypch90a9f2k1i";
  };

  # can be used at build time only
  nativeBuildInputs = [ 
    cmake
  ];

   # can be used at build time and run time
  buildInputs = [
    boost
    gbenchmark
  ];
}

Build and run:

nix-build -E 'with import <nixpkgs> {}; callPackage ./bench.nix {}'
./result/bin/bench

note on the Nix language, why?