1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 curl,
6 cmake,
7 nlohmann_json,
8}:
9
10stdenv.mkDerivation {
11 pname = "cpp-ipfs-http-client";
12 version = "unstable-2022-01-30";
13
14 src = fetchFromGitHub {
15 owner = "vasild";
16 repo = "cpp-ipfs-http-client";
17 rev = "3cdfa7fc6326e49fc81b3c7ca43ce83bdccef6d9";
18 sha256 = "sha256-/oyafnk4SbrvoCh90wkZXNBjknMKA6EEUoEGo/amLUo=";
19 };
20
21 patches = [ ./unvendor-nlohmann-json.patch ];
22
23 postPatch = ''
24 substituteInPlace CMakeLists.txt \
25 --replace '# Fetch "JSON for Modern C++"' "include_directories(${nlohmann_json}/include)"
26 '';
27
28 nativeBuildInputs = [ cmake ];
29 buildInputs = [ curl ];
30 propagatedBuildInputs = [ nlohmann_json ];
31
32 env.NIX_CFLAGS_COMPILE = toString [
33 "-Wno-error=range-loop-construct"
34 # Needed with GCC 12
35 "-Wno-error=deprecated-declarations"
36 ];
37
38 meta = with lib; {
39 description = "IPFS C++ API client library";
40 homepage = "https://github.com/vasild/cpp-ipfs-http-client";
41 license = licenses.mit;
42 platforms = [
43 "x86_64-linux"
44 "x86_64-darwin"
45 ];
46 };
47}