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