nixpkgs/pkgs/by-name/gb/gbenchmark/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

55 lines
1.4 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cmake
, ninja
, gtest
, prometheus-cpp
}:
stdenv.mkDerivation rec {
pname = "gbenchmark";
version = "1.9.0";
src = fetchFromGitHub {
owner = "google";
repo = "benchmark";
rev = "v${version}";
hash = "sha256-5cl1PIjhXaL58kSyWZXRWLq6BITS2BwEovPhwvk2e18=";
};
nativeBuildInputs = [ cmake ninja ];
buildInputs = [ gtest ];
cmakeFlags = [
(lib.cmakeBool "BENCHMARK_USE_BUNDLED_GTEST" false)
(lib.cmakeBool "BENCHMARK_ENABLE_WERROR" false)
];
# We ran into issues with gtest 1.8.5 conditioning on
# `#if __has_cpp_attribute(maybe_unused)`, which was, for some
# reason, going through even when C++14 was being used and
# breaking the build on Darwin by triggering errors about using
# C++17 features.
#
# This might be a problem with our Clang, as it does not reproduce
# with Xcode, but we just work around it by silencing the warning.
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-c++17-attribute-extensions";
# Tests fail on 32-bit due to not enough precision
doCheck = stdenv.hostPlatform.is64bit;
passthru.tests = {
inherit prometheus-cpp;
};
meta = with lib; {
description = "Microbenchmark support library";
homepage = "https://github.com/google/benchmark";
license = licenses.asl20;
platforms = platforms.linux ++ platforms.darwin ++ platforms.freebsd;
maintainers = with maintainers; [ abbradar ];
};
}