about summary refs log tree commit diff
path: root/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-08-04T03·50-0400
committerglittershark <grfn@gws.fyi>2020-08-05T03·24+0000
commit28c7e926ea48e4f5e57b9b8d1a70ccc494b2c188 (patch)
treeeb45441b3550fcd097d872dd23c0d87c8209e13a /third_party/nix/src/nix-daemon/nix-daemon-proto.cc
parentb15b447fcb25fc6232a61cbe5c869fa473c12efc (diff)
feat(3p/nix): Implement AddToStore rpc client r/1594
Implement the AddToStore RPC client method, which uses an
AddToStorePathWriterSink (the dual of the AddToStorePathReaderSource on
the server side) to hook into the dumpPath machinery (which we should
refactor not to use sinks or sources, but not yet) and write dumped
paths as binary data over gRPC. With this commit and sandboxing
disabled, the following derivation builds cleanly:

    derivation {
      name = "test";
      builder = ./build.sh;
      system = "x86_64-linux";
    }

where build.sh has chmod +x and contains:

    #!/bin/sh
    echo 1 > $out

Change-Id: I94cab86f0825a3a9993262a9807130645c13bf44
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1638
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Tested-by: BuildkiteCI
Diffstat (limited to '')
-rw-r--r--third_party/nix/src/nix-daemon/nix-daemon-proto.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
index b3ecc9d5b9..fe580b08a2 100644
--- a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
+++ b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
@@ -146,7 +146,7 @@ class WorkerServiceImpl final : public WorkerService::Service {
           proto::AddToStoreRequest metadata_request;
           auto has_metadata = reader->Read(&metadata_request);
 
-          if (!has_metadata || metadata_request.has_meta()) {
+          if (!has_metadata || !metadata_request.has_meta()) {
             return Status(grpc::StatusCode::INVALID_ARGUMENT,
                           "Metadata must be set before sending file content");
           }