8 testData = fetchFromGitHub {
10 repo = "json_test_data";
12 hash = "sha256-bG34W63ew7haLnC82A3lS7bviPDnApLipaBjJAjLcVk=";
14 in stdenv.mkDerivation (finalAttrs: {
15 pname = "nlohmann_json";
18 src = fetchFromGitHub {
21 rev = "v${finalAttrs.version}";
22 hash = "sha256-SUdhIV7tjtacf5DkoWk9cnkfyMlrkg8ZU7XnPZd22Tw=";
26 # Backport fix for gcc-13:
27 # https://github.com/nlohmann/json/pull/3895
29 name = "gcc-13-rebind.patch";
30 url = "https://github.com/nlohmann/json/commit/a5b09d50b786638ed9deb09ef13860a3cb64eb6b.patch";
31 hash = "sha256-Jbi0VwZP+ZHTGbpIwgKCVc66gOmwjkT5iOUe85eIzM0=";
34 # Backport fix for gcc-13:
35 # https://github.com/nlohmann/json/pull/3950
37 name = "gcc-13-eq-op.patch";
38 url = "https://github.com/nlohmann/json/commit/a49829bd984c0282be18fcec070df0c31bf77dd5.patch";
39 hash = "sha256-D+cRtdN6AXr4z3/y9Ui7Zqp3e/y10tp+DOL80ZtPz5E=";
43 nativeBuildInputs = [ cmake ];
46 "-DJSON_BuildTests=${if finalAttrs.doCheck then "ON" else "OFF"}"
48 "-DJSON_MultipleHeaders=ON"
49 ] ++ lib.optional finalAttrs.doCheck "-DJSON_TestDataDirectory=${testData}";
51 doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
53 # skip tests that require git or modify “installed files”
55 checkFlagsArray+=("ARGS=-LE 'not_reproducible|git_required'")
58 postInstall = "rm -rf $out/lib64";
61 description = "JSON for Modern C++";
62 homepage = "https://json.nlohmann.me";
63 changelog = "https://github.com/nlohmann/json/blob/develop/ChangeLog.md";
64 license = licenses.mit;
65 platforms = platforms.all;