about summary refs log tree commit diff
path: root/tvix/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-01-06T17·20+0300
committertazjin <tazjin@tvl.su>2023-01-06T17·57+0000
commit3e03e59893b77b0b3915224967b377f6e940670d (patch)
treec2fd130c402a651e0e9c3dab87469976a856d3b0 /tvix/default.nix
parent144d010515c5a92c4a8ee05b95a913973f8bc6f2 (diff)
refactor(tvix/store): move protobuf build config one level up r/5615
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 <tazjin@tvl.su>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/default.nix')
-rw-r--r--tvix/default.nix24
1 files changed, 24 insertions, 0 deletions
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