chore(3p/nix): don't rebuild nix-proto-srcs as much

Interpolating a path into a string will copy the referenced path into
the Nix store, so this got a dependency on all of src.  By first
constructing a path to the src/proto directory using the + operator,
and then interpolating it, we limit what is copied to the store, and
therefore what code triggers a nix-proto-srcs rebuild.

Change-Id: I8dd750f6bc5902b74ffb56470bc8a5f2c01c8cf1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1263
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
Alyssa Ross 2020-07-18 00:16:13 +00:00
parent b2e0ccfe9a
commit cbea59c5f6

View file

@ -21,7 +21,7 @@ let
# Proto generation in CMake is theoretically possible, but that is # Proto generation in CMake is theoretically possible, but that is
# very theoretical - this does it in Nix instead. # very theoretical - this does it in Nix instead.
protoSrcs = pkgs.runCommand "nix-proto-srcs" {} '' protoSrcs = pkgs.runCommand "nix-proto-srcs" {} ''
export PROTO_SRCS=${src}/src/proto export PROTO_SRCS=${src + "/src/proto"}
mkdir -p $out/libproto mkdir -p $out/libproto
${pkgs.protobuf}/bin/protoc -I=$PROTO_SRCS \ ${pkgs.protobuf}/bin/protoc -I=$PROTO_SRCS \
--cpp_out=$out/libproto \ --cpp_out=$out/libproto \