about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tvix/Cargo.nix1
-rw-r--r--tvix/build/Cargo.toml2
-rw-r--r--tvix/build/src/buildservice/grpc.rs28
-rw-r--r--tvix/build/src/buildservice/mod.rs2
4 files changed, 32 insertions, 1 deletions
diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix
index a67738397f66..71f456290d1d 100644
--- a/tvix/Cargo.nix
+++ b/tvix/Cargo.nix
@@ -10240,6 +10240,7 @@ rec {
           {
             name = "tonic";
             packageId = "tonic 0.10.2";
+            features = [ "tls" "tls-roots" ];
           }
           {
             name = "tonic-reflection";
diff --git a/tvix/build/Cargo.toml b/tvix/build/Cargo.toml
index 2782128db301..52dcf0abec0c 100644
--- a/tvix/build/Cargo.toml
+++ b/tvix/build/Cargo.toml
@@ -8,7 +8,7 @@ bytes = "1.4.0"
 itertools = "0.12.0"
 prost = "0.12.1"
 thiserror = "1.0.56"
-tonic = "0.10.2"
+tonic = { version = "0.10.2", features = ["tls", "tls-roots"] }
 tvix-castore = { path = "../castore" }
 tracing = "0.1.37"
 
diff --git a/tvix/build/src/buildservice/grpc.rs b/tvix/build/src/buildservice/grpc.rs
new file mode 100644
index 000000000000..9d22d8397abf
--- /dev/null
+++ b/tvix/build/src/buildservice/grpc.rs
@@ -0,0 +1,28 @@
+use tonic::{async_trait, transport::Channel};
+
+use crate::proto::{build_service_client::BuildServiceClient, Build, BuildRequest};
+
+use super::BuildService;
+
+pub struct GRPCBuildService {
+    client: BuildServiceClient<Channel>,
+}
+
+impl GRPCBuildService {
+    #[allow(dead_code)]
+    pub fn from_client(client: BuildServiceClient<Channel>) -> Self {
+        Self { client }
+    }
+}
+
+#[async_trait]
+impl BuildService for GRPCBuildService {
+    async fn do_build(&self, request: BuildRequest) -> std::io::Result<Build> {
+        let mut client = self.client.clone();
+        client
+            .do_build(request)
+            .await
+            .map(|resp| resp.into_inner())
+            .map_err(std::io::Error::other)
+    }
+}
diff --git a/tvix/build/src/buildservice/mod.rs b/tvix/build/src/buildservice/mod.rs
index cd0b7eb5d70f..cbee221a5e23 100644
--- a/tvix/build/src/buildservice/mod.rs
+++ b/tvix/build/src/buildservice/mod.rs
@@ -3,6 +3,8 @@ use tonic::async_trait;
 use crate::proto::{Build, BuildRequest};
 
 mod dummy;
+mod grpc;
+
 pub use dummy::DummyBuildService;
 
 #[async_trait]