about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--third_party/nix/default.nix39
1 files changed, 35 insertions, 4 deletions
diff --git a/third_party/nix/default.nix b/third_party/nix/default.nix
index d07011dd0b8a..ad50ac6b7fea 100644
--- a/third_party/nix/default.nix
+++ b/third_party/nix/default.nix
@@ -6,6 +6,36 @@ args@{ depot ? (import ../.. { })
 }:
 
 let
+  # Override some external dependencies for C++17 & clang compat.
+  abseil-cpp = pkgs.abseil-cpp.override {
+    stdenv = pkgs.fullLlvm11Stdenv;
+    cxxStandard = "17";
+  };
+
+  protobuf = pkgs.callPackage (pkgs.path + "/pkgs/development/libraries/protobuf/generic-v3.nix") {
+    version = "3.12.2";
+    sha256 = "1lp368aa206vpic9fmax4k6llnmf28plfvkkm4vqhgphmjqykvl2";
+    stdenv = pkgs.fullLlvm11Stdenv;
+    buildPackages = {
+      inherit (pkgs.buildPackages) which;
+      stdenv = pkgs.buildPackages.fullLlvm11Stdenv;
+    };
+  };
+
+  re2 = pkgs.re2.override {
+    stdenv = pkgs.fullLlvm11Stdenv;
+  };
+
+  grpc = (pkgs.grpc.override {
+    inherit abseil-cpp protobuf re2;
+    stdenv = pkgs.fullLlvm11Stdenv;
+  }).overrideAttrs (orig: rec {
+    cmakeFlags = orig.cmakeFlags ++ [
+      "-DCMAKE_CXX_STANDARD_REQUIRED=ON"
+      "-DCMAKE_CXX_STANDARD=17"
+    ];
+  });
+
   aws-s3-cpp = pkgs.aws-sdk-cpp.override {
     apis = [ "s3" "transfer" ];
     customMemoryManagement = false;
@@ -46,9 +76,9 @@ let
   protoSrcs = pkgs.runCommand "nix-proto-srcs" { } ''
     export PROTO_SRCS=${./src/proto}
     mkdir -p $out/libproto
-    ${depot.third_party.protobuf}/bin/protoc -I=$PROTO_SRCS \
+    ${protobuf}/bin/protoc -I=$PROTO_SRCS \
       --cpp_out=$out/libproto \
-      --plugin=protoc-gen-grpc=${depot.third_party.grpc}/bin/grpc_cpp_plugin \
+      --plugin=protoc-gen-grpc=${grpc}/bin/grpc_cpp_plugin \
         --grpc_out=$out/libproto \
         $PROTO_SRCS/*.proto
   '';
@@ -92,8 +122,9 @@ lib.fix (self: pkgs.fullLlvm11Stdenv.mkDerivation {
     sqlite
     systemd.dev
     xz
-  ]) ++ (with depot.third_party; [
-    abseil_cpp
+
+    # dependencies with custom overrides
+    abseil-cpp
     grpc
     protobuf
   ]);