2021-09-18 10:52:07 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
2021-09-18 10:52:07 +00:00
|
|
|
let
|
|
|
|
testData = fetchFromGitHub {
|
|
|
|
owner = "nlohmann";
|
|
|
|
repo = "json_test_data";
|
|
|
|
rev = "v3.0.0";
|
|
|
|
sha256 = "O6p2PFB7c2KE9VqWvmTaFywbW1hSzAP5V42EuemX+ls=";
|
|
|
|
};
|
2022-07-18 16:21:45 +00:00
|
|
|
in stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "nlohmann_json";
|
2022-06-16 17:23:12 +00:00
|
|
|
version = "3.10.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "nlohmann";
|
|
|
|
repo = "json";
|
2022-07-18 16:21:45 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
2022-06-16 17:23:12 +00:00
|
|
|
sha256 = "DTsZrdB9GcaNkx7ZKxcgCA3A9ShM5icSF0xyGguJNbk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2022-07-18 16:21:45 +00:00
|
|
|
"-DBuildTests=${if finalAttrs.doCheck then "ON" else "OFF"}"
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DJSON_MultipleHeaders=ON"
|
2022-07-18 16:21:45 +00:00
|
|
|
] ++ lib.optional finalAttrs.doCheck "-DJSON_TestDataDirectory=${testData}";
|
2021-09-18 10:52:07 +00:00
|
|
|
|
|
|
|
doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
# skip tests that require git or modify “installed files”
|
|
|
|
preCheck = ''
|
|
|
|
checkFlagsArray+=("ARGS=-LE 'not_reproducible|git_required'")
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postInstall = "rm -rf $out/lib64";
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2021-09-18 10:52:07 +00:00
|
|
|
description = "JSON for Modern C++";
|
|
|
|
homepage = "https://json.nlohmann.me";
|
|
|
|
changelog = "https://github.com/nlohmann/json/blob/develop/ChangeLog.md";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
2022-07-18 16:21:45 +00:00
|
|
|
})
|