From 74b7349bd3c8ee59488ff356a3229784f501f4dd Mon Sep 17 00:00:00 2001 From: Alois Wohlschlager Date: Tue, 23 Sep 2025 20:41:54 +0200 Subject: [PATCH] nlohmann_json: fix musl build Musl does not support LC_NUMERIC [1], so the relevant test introduced in nlohmann_json 3.12 fails. To restore compatibility, the error has been turned into a warning upstream [2]. Pick the patch. [1] https://wiki.musl-libc.org/open-issues.html [2] https://github.com/nlohmann/json/pull/4770 --- pkgs/by-name/nl/nlohmann_json/package.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/by-name/nl/nlohmann_json/package.nix b/pkgs/by-name/nl/nlohmann_json/package.nix index c07501a80c14..e11fa98c8373 100644 --- a/pkgs/by-name/nl/nlohmann_json/package.nix +++ b/pkgs/by-name/nl/nlohmann_json/package.nix @@ -2,6 +2,7 @@ stdenv, lib, fetchFromGitHub, + fetchpatch, cmake, }: let @@ -23,6 +24,16 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-cECvDOLxgX7Q9R3IE86Hj9JJUxraDQvhoyPDF03B2CY="; }; + patches = lib.optionals stdenv.hostPlatform.isMusl [ + # Musl does not support LC_NUMERIC, causing a test failure. + # Turn the error into a warning to make the test succeed. + # https://github.com/nlohmann/json/pull/4770 + (fetchpatch { + url = "https://github.com/nlohmann/json/commit/0a8b48ac6a89131deaeb0d57047c9462a23b34a2.diff"; + hash = "sha256-gOZfRyDRI6USdUIY+sH7cygPrSIKGIo8AWcjqc/GQNI="; + }) + ]; + nativeBuildInputs = [ cmake ]; cmakeFlags = [