From a79df261b498473ae7c6d4a04f32c50d5954124f Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Fri, 17 Jul 2020 09:30:04 -0400 Subject: feat(3p/nix/nix-daemon): Implement Worker::BuildDerivation handler Implement the proto handler on the server side for Worker::BuildDerivation. This includes several additions to the proto which I had missed on the first pass, including the actual proto definition for the Derivation itself and a few sequence number reorderings which are fine because this is all provisional and not deployed yet. A couple things to note - I implemented a couple constructors for nix classes that initialize themselves based on their proto variants, which felt nice and didn't end up causing any issues. - I've made the conversions between the enum types in nix and in proto explicit via switch statements rather than using a static_cast, out of an abundance of caution that the error would get mismatched in the future and we'd convert the wrong thing to the wrong thing - this is verbose, but exceptionally future proof. Change-Id: Iecf6b88e76bc37e49efa05fd65d6cd0cb0deffed Reviewed-on: https://cl.tvl.fyi/c/depot/+/1249 Tested-by: BuildkiteCI Reviewed-by: tazjin Reviewed-by: Kane York --- third_party/nix/src/proto/worker.proto | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'third_party/nix/src/proto/worker.proto') diff --git a/third_party/nix/src/proto/worker.proto b/third_party/nix/src/proto/worker.proto index 8e629da709..3dd83d9988 100644 --- a/third_party/nix/src/proto/worker.proto +++ b/third_party/nix/src/proto/worker.proto @@ -288,10 +288,25 @@ message VerifyStoreResponse { bool errors = 1; } +message Derivation { + message DerivationOutput { + StorePath path = 1; + string hash_algo = 2; + bytes hash = 3; + } + map outputs = 1; + StorePaths input_sources = 2; + string platform = 3; + StorePath builder = 4; + repeated string args = 5; + map env = 6; +} + message BuildDerivationRequest { // Only used for informational purposes. StorePath drv_path = 1; - BuildMode build_mode = 2; + Derivation derivation = 2; + BuildMode build_mode = 3; } message BuildDerivationResponse { -- cgit 1.4.1