From 3e03e59893b77b0b3915224967b377f6e940670d Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 6 Jan 2023 20:20:44 +0300 Subject: refactor(tvix/store): move protobuf build config one level up This embeds the build config directly at the point where `Cargo.nix` is imported, making it transparent to library consumers. Change-Id: I5586e12f02ed14587c32d9ef7d93f079366fb127 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7780 Autosubmit: tazjin Reviewed-by: flokli Tested-by: BuildkiteCI --- tvix/default.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tvix/default.nix') diff --git a/tvix/default.nix b/tvix/default.nix index d0357fe24ef8..f0da4d05b335 100644 --- a/tvix/default.nix +++ b/tvix/default.nix @@ -1,11 +1,35 @@ # Nix helpers for projects under //tvix { pkgs, depot, ... }: +let + # crate override for crates that need protobuf + protobufDep = prev: (prev.nativeBuildInputs or [ ]) ++ [ pkgs.protobuf ]; +in { # Load the crate2nix crate tree. crates = import ./Cargo.nix { inherit pkgs; nixpkgs = pkgs.path; + + defaultCrateOverrides = pkgs.defaultCrateOverrides // { + prost-build = prev: { + nativeBuildInputs = protobufDep prev; + }; + + tonic-reflection = prev: { + nativeBuildInputs = protobufDep prev; + }; + + tvix-store = prev: { + PROTO_ROOT = depot.tvix.store.protos; + nativeBuildInputs = protobufDep prev; + }; + + tvix-store-bin = prev: { + PROTO_ROOT = depot.tvix.store.protos; + nativeBuildInputs = protobufDep prev; + }; + }; }; # Run crate2nix generate in the current working directory, then -- cgit 1.4.1