about summary refs log tree commit diff
path: root/third_party/nix/src
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src')
-rw-r--r--third_party/nix/src/nix-daemon/nix-daemon-proto.cc10
1 files changed, 10 insertions, 0 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 35171c769ab8..d847ebff758b 100644
--- a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
+++ b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
@@ -21,6 +21,16 @@ class WorkerServiceImpl final : public Worker::Service {
     return Status::OK;
   }
 
+  Status HasSubstitutes(grpc::ServerContext* context, const StorePath* request,
+                        nix::proto::HasSubstitutesResponse* response) {
+    const auto& path = request->path();
+    store_->assertStorePath(path);
+    PathSet res = store_->querySubstitutablePaths({path});
+    response->set_has_substitutes(res.find(path) != res.end());
+
+    return Status::OK;
+  }
+
  private:
   // TODO(tazjin): Who owns the store?
   nix::Store* store_;