9 # One of "11" or "17"; default in source is CXX 11
12 , buildTests ? !stdenv.hostPlatform.isStatic && !stdenv.isDarwin
13 , buildExamples ? true
16 stdenv.mkDerivation (finalAttrs: {
18 version = "unstable-2023-09-28";
22 ] ++ lib.optionals buildDocs [
24 ] ++ lib.optionals buildExamples [
28 src = fetchFromGitHub {
31 rev = "f9d53419e912910fd8fa57d5705fa41425428c35";
32 hash = "sha256-rl7iy14jn1K2I5U2DrcZnoTQVEGEDKlxmdaOCF/3hfY=";
35 patches = lib.optionals buildTests [
36 ./0000-unstable-use-nixpkgs-gtest.patch
37 # https://github.com/Tencent/rapidjson/issues/2214
38 ./0001-unstable-valgrind-suppress-failures.patch
43 ] ++ lib.optionals buildDocs [
49 (lib.cmakeBool "RAPIDJSON_BUILD_DOC" buildDocs)
50 (lib.cmakeBool "RAPIDJSON_BUILD_TESTS" buildTests)
51 (lib.cmakeBool "RAPIDJSON_BUILD_EXAMPLES" buildExamples)
52 (lib.cmakeBool "RAPIDJSON_BUILD_CXX11" (cxxStandard == "11"))
53 (lib.cmakeBool "RAPIDJSON_BUILD_CXX17" (cxxStandard == "17"))
54 ] ++ lib.optionals buildTests [
55 (lib.cmakeFeature "GTEST_INCLUDE_DIR" "${lib.getDev gtest}")
65 postInstall = lib.optionalString buildExamples ''
68 find bin -type f -executable \
69 -not -name "perftest" \
70 -not -name "unittest" \
71 -exec cp -a {} $example/bin \;
75 description = "Fast JSON parser/generator for C++ with both SAX/DOM style API";
76 homepage = "http://rapidjson.org/";
77 license = licenses.mit;
78 platforms = platforms.unix;
79 maintainers = with maintainers; [ Madouura ];
80 broken = (cxxStandard != "11" && cxxStandard != "17");