From b6f477e6e78c740ed2f26e7a24b0430e2708fd63 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 10 Jun 2026 19:14:48 +0200 Subject: [PATCH] gbenchmark: fix eval and build on musl glibcLocales is only non-null when stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isGnu, so when it was added it broke eval of this package on musl. Fix the platform checks to be more accurate, and backport an upstream fix for more accurate platform checks on their side, to get building on musl again. Fixes: f6da9198396a ("gbenchmark: 1.9.4 -> 1.9.5") --- pkgs/by-name/gb/gbenchmark/package.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/gb/gbenchmark/package.nix b/pkgs/by-name/gb/gbenchmark/package.nix index 9d21e2c8a84b..a35f4781dba1 100644 --- a/pkgs/by-name/gb/gbenchmark/package.nix +++ b/pkgs/by-name/gb/gbenchmark/package.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchFromGitHub, + fetchpatch, cmake, ninja, gtest, @@ -20,6 +21,14 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-Mm4pG7zMB00iof32CxreoNBFnduPZTMp3reHMCIAFPQ="; }; + patches = [ + (fetchpatch { + name = "portability.patch"; + url = "https://github.com/google/benchmark/commit/b5ba9bab85d80f29a161dd634b7d234cf3722f90.patch"; + hash = "sha256-/X01AWXK0eJ59F8oSREZ7V5Cpw1y35n9uFB1mCvMOus="; + }) + ]; + nativeBuildInputs = [ cmake ninja @@ -27,7 +36,7 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ gtest ]; - nativeCheckInputs = lib.optionals stdenv.hostPlatform.isLinux [ glibcLocales ]; + nativeCheckInputs = lib.optionals (glibcLocales != null) [ glibcLocales ]; cmakeFlags = [ (lib.cmakeBool "BENCHMARK_USE_BUNDLED_GTEST" false) @@ -45,10 +54,12 @@ stdenv.mkDerivation (finalAttrs: { # with Xcode, but we just work around it by silencing the warning. NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-c++17-attribute-extensions"; } - // lib.optionalAttrs stdenv.hostPlatform.isLinux { + // lib.optionalAttrs stdenv.hostPlatform.isGnu { # For test:locale_impermeability_test LANG = "en_US.UTF-8"; LC_ALL = "en_US.UTF-8"; + } + // lib.optionalAttrs (glibcLocales != null) { LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; };