refactor(tvix): use granular proto files

Only pass in the proto files that are actually needed to build that
crate. They are already constructed in depot.tvix.$crate.protos.protos.

Change-Id: If4381e6c3350e420ee4ddce1e0513bfe970678a2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10240
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-12-09 15:49:56 +02:00 committed by clbot
parent 43943e2623
commit 1cc3e9c1a8
2 changed files with 17 additions and 23 deletions

View file

@ -41,12 +41,12 @@ let
}; };
tvix-build = prev: { tvix-build = prev: {
PROTO_ROOT = depot.tvix.proto; PROTO_ROOT = depot.tvix.build.protos.protos;
nativeBuildInputs = protobufDep prev; nativeBuildInputs = protobufDep prev;
}; };
tvix-castore = prev: { tvix-castore = prev: {
PROTO_ROOT = depot.tvix.proto; PROTO_ROOT = depot.tvix.castore.protos.protos;
nativeBuildInputs = protobufDep prev; nativeBuildInputs = protobufDep prev;
}; };
@ -55,7 +55,7 @@ let
}; };
tvix-store = prev: { tvix-store = prev: {
PROTO_ROOT = depot.tvix.proto; PROTO_ROOT = depot.tvix.store.protos.protos;
nativeBuildInputs = protobufDep prev; nativeBuildInputs = protobufDep prev;
# fuse-backend-rs uses DiskArbitration framework to handle mount/unmount on Darwin # fuse-backend-rs uses DiskArbitration framework to handle mount/unmount on Darwin
buildInputs = prev.buildInputs or [ ] buildInputs = prev.buildInputs or [ ]
@ -101,9 +101,20 @@ let
${depot.tools.depotfmt}/bin/depotfmt Cargo.nix ${depot.tools.depotfmt}/bin/depotfmt Cargo.nix
''; '';
# Target containing *all* tvix proto files.
# Useful for workspace-wide cargo invocations (doc, clippy)
protos = pkgs.symlinkJoin {
name = "tvix-all-protos";
paths = [
depot.tvix.build.protos.protos
depot.tvix.castore.protos.protos
depot.tvix.store.protos.protos
];
};
in in
{ {
inherit crates crate2nix-generate; inherit crates crate2nix-generate protos;
# Run crate2nix generate, ensure the output doesn't differ afterwards # Run crate2nix generate, ensure the output doesn't differ afterwards
# (and doesn't fail). # (and doesn't fail).
@ -179,7 +190,7 @@ in
rust-docs = pkgs.stdenv.mkDerivation { rust-docs = pkgs.stdenv.mkDerivation {
inherit cargoDeps src; inherit cargoDeps src;
name = "tvix-rust-docs"; name = "tvix-rust-docs";
PROTO_ROOT = depot.tvix.proto; PROTO_ROOT = protos;
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
cargo cargo
@ -204,7 +215,7 @@ in
clippy = pkgs.stdenv.mkDerivation { clippy = pkgs.stdenv.mkDerivation {
inherit cargoDeps src; inherit cargoDeps src;
name = "tvix-clippy"; name = "tvix-clippy";
PROTO_ROOT = depot.tvix.proto; PROTO_ROOT = protos;
buildInputs = [ buildInputs = [
pkgs.fuse pkgs.fuse

View file

@ -1,17 +0,0 @@
# Target containing just the proto files used in tvix
{ depot, lib, ... }:
depot.nix.sparseTree {
name = "tvix-protos";
root = depot.path.origSrc;
paths = [
../build/protos/build.proto
../build/protos/rpc_build.proto
../castore/protos/castore.proto
../castore/protos/rpc_blobstore.proto
../castore/protos/rpc_directory.proto
../store/protos/pathinfo.proto
../store/protos/rpc_pathinfo.proto
];
}