1{ stdenv, fetchFromGitHub, cmake
2, hostPlatform
3}:
4
5stdenv.mkDerivation rec {
6 name = "nlohmann_json-${version}";
7 version = "3.1.1";
8
9 src = fetchFromGitHub {
10 owner = "nlohmann";
11 repo = "json";
12 rev = "v${version}";
13 sha256 = "0s5xiyvnvxc2k0zkyb12mm5cwn61lavyxlfpknlx5f243g1xi6f6";
14 };
15
16 nativeBuildInputs = [ cmake ];
17
18 doCheck = true;
19 checkTarget = "test";
20
21 enableParallelBuilding = true;
22
23 crossAttrs = {
24 cmakeFlags = "-DBuildTests=OFF";
25 doCheck = false;
26 } // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
27 cmakeFlags = "-DBuildTests=OFF -DCMAKE_SYSTEM_NAME=Windows";
28 };
29
30 meta = with stdenv.lib; {
31 description = "Header only C++ library for the JSON file format";
32 homepage = https://github.com/nlohmann/json;
33 license = licenses.mit;
34 platforms = platforms.all;
35 };
36}