at 22.05-pre 47 lines 1.2 kB view raw
1{ stdenv 2, lib 3, fetchFromGitHub 4, cmake 5}: 6let 7 testData = fetchFromGitHub { 8 owner = "nlohmann"; 9 repo = "json_test_data"; 10 rev = "v3.0.0"; 11 sha256 = "O6p2PFB7c2KE9VqWvmTaFywbW1hSzAP5V42EuemX+ls="; 12 }; 13in stdenv.mkDerivation rec { 14 pname = "nlohmann_json"; 15 version = "3.10.2"; 16 17 src = fetchFromGitHub { 18 owner = "nlohmann"; 19 repo = "json"; 20 rev = "v${version}"; 21 sha256 = "/OFNfukrIyfJmD0ko174aud9T6ZOesHANJjyfk4q/Vs="; 22 }; 23 24 nativeBuildInputs = [ cmake ]; 25 26 cmakeFlags = [ 27 "-DBuildTests=${if doCheck then "ON" else "OFF"}" 28 "-DJSON_MultipleHeaders=ON" 29 ] ++ lib.optional doCheck "-DJSON_TestDataDirectory=${testData}"; 30 31 doCheck = stdenv.hostPlatform == stdenv.buildPlatform; 32 33 # skip tests that require git or modify “installed files” 34 preCheck = '' 35 checkFlagsArray+=("ARGS=-LE 'not_reproducible|git_required'") 36 ''; 37 38 postInstall = "rm -rf $out/lib64"; 39 40 meta = with lib; { 41 description = "JSON for Modern C++"; 42 homepage = "https://json.nlohmann.me"; 43 changelog = "https://github.com/nlohmann/json/blob/develop/ChangeLog.md"; 44 license = licenses.mit; 45 platforms = platforms.all; 46 }; 47}