1{ stdenv, clang-tools, grpc, curl, cmake, pkgconfig, fetchFromGitHub, doxygen, protobuf, crc32c, c-ares, fetchurl, openssl, zlib }:
2let
3 googleapis = fetchFromGitHub {
4 owner = "googleapis";
5 repo = "googleapis";
6 rev = "9c9f778aedde02f9826d2ae5d0f9c96409ba0f25";
7 sha256 = "1gd3nwv8qf503wy6km0ad6akdvss9w5b1k3jqizy5gah1fkirkpi";
8 };
9 googleapis-cpp-cmakefiles = stdenv.mkDerivation rec {
10 pname = "googleapis-cpp-cmakefiles";
11 version = "0.1.5";
12 src = fetchFromGitHub {
13 owner = "googleapis";
14 repo = "cpp-cmakefiles";
15 rev = "v${version}";
16 sha256 = "02zkcq2wl831ayd9qy009xvfx7q80pgycx7mzz9vknwd0nn6dd0n";
17 };
18
19 nativeBuildInputs = [ cmake pkgconfig ];
20 buildInputs = [ c-ares c-ares.cmake-config grpc openssl protobuf zlib ];
21
22 postPatch = ''
23 sed -e 's,https://github.com/googleapis/googleapis/archive/9c9f778aedde02f9826d2ae5d0f9c96409ba0f25.tar.gz,file://${googleapis},' \
24 -i CMakeLists.txt
25 '';
26 };
27 _nlohmann_json = fetchurl {
28 url = "https://github.com/nlohmann/json/releases/download/v3.4.0/json.hpp";
29 sha256 = "0pw3jpi572irbp2dqclmyhgic6k9rxav5mpp9ygbp9xj48gnvnk3";
30 };
31in stdenv.mkDerivation rec {
32 pname = "google-cloud-cpp";
33 version = "0.14.0";
34
35 src = fetchFromGitHub {
36 owner = "googleapis";
37 repo = "google-cloud-cpp";
38 rev = "v${version}";
39 sha256 = "15wci4m8h6py7fqfziq8mp5m6pxp2h1cbh5rp2k90mk5js4jb9pa";
40 };
41
42 buildInputs = [ curl crc32c c-ares c-ares.cmake-config googleapis-cpp-cmakefiles grpc protobuf ];
43 nativeBuildInputs = [ clang-tools cmake pkgconfig doxygen ];
44
45 outputs = [ "out" "dev" ];
46
47 postPatch = ''
48 sed -e 's,https://github.com/nlohmann/json/releases/download/v3.4.0/json.hpp,file://${_nlohmann_json},' \
49 -i cmake/DownloadNlohmannJson.cmake
50 '';
51
52 cmakeFlags = [
53 "-DBUILD_SHARED_LIBS:BOOL=ON"
54 ];
55
56 meta = with stdenv.lib; {
57 license = with licenses; [ asl20 ];
58 homepage = "https://github.com/googleapis/google-cloud-cpp";
59 description = "C++ Idiomatic Clients for Google Cloud Platform services";
60 maintainers = with maintainers; [ andir flokli ];
61 };
62}