From aa96c3bd833283af1a9bdb7e5a6787a4e9201b57 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 8 Feb 2022 02:12:02 +0300 Subject: [PATCH] refactor(3p/nix): Inline LLVM overrides on dependencies Change-Id: I5963ef4b83f1df25273a869f0e85144d347e444b Reviewed-on: https://cl.tvl.fyi/c/depot/+/5251 Tested-by: BuildkiteCI Autosubmit: tazjin Reviewed-by: sterni --- third_party/nix/default.nix | 39 +++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/third_party/nix/default.nix b/third_party/nix/default.nix index d07011dd0..ad50ac6b7 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 ]);