about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/rpc-store.cc
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-11-27T23·12-0500
committerglittershark <grfn@gws.fyi>2020-11-28T00·47+0000
commit49024be05644d4fac252e2191e9de74e0ffd4fe3 (patch)
tree73658943ab7a8230215a59e5ec9288882463bc2e /third_party/nix/src/libstore/rpc-store.cc
parent1d22874ab29f696c38146750bdd26645d4d75ccc (diff)
feat(tvix): Thread a log sink through calls to buildDerivation r/1946
Similarly to how we did for buildPaths, add a std::ostream& log_sink
parameter to the build_derivation method on Store, and pass it std::cerr
when called at the top level by nix commands - most notably, the
build-remote hook binary, so that we get build logs when using tvix as a
remote builder.

Change-Id: I0f8f729ba8429d4838a0a135a5c2ac1e1a95d575
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2176
Tested-by: BuildkiteCI
Reviewed-by: andi <andi@notmuch.email>
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Diffstat (limited to 'third_party/nix/src/libstore/rpc-store.cc')
-rw-r--r--third_party/nix/src/libstore/rpc-store.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/third_party/nix/src/libstore/rpc-store.cc b/third_party/nix/src/libstore/rpc-store.cc
index afaeca4a660e..c29bd059de9b 100644
--- a/third_party/nix/src/libstore/rpc-store.cc
+++ b/third_party/nix/src/libstore/rpc-store.cc
@@ -374,7 +374,8 @@ absl::Status RpcStore::buildPaths(std::ostream& log_sink, const PathSet& paths,
   return nix::util::proto::GRPCStatusToAbsl(reader->Finish());
 }
 
-BuildResult RpcStore::buildDerivation(const Path& drvPath,
+BuildResult RpcStore::buildDerivation(std::ostream& log_sink,
+                                      const Path& drvPath,
                                       const BasicDerivation& drv,
                                       BuildMode buildMode) {
   ClientContext ctx;
@@ -392,7 +393,7 @@ BuildResult RpcStore::buildDerivation(const Path& drvPath,
   proto::BuildEvent event;
   while (reader->Read(&event)) {
     if (event.has_build_log()) {
-      LOG(INFO) << event.build_log().line();
+      log_sink << event.build_log().line();
     } else if (event.has_result()) {
       result = BuildResult::FromProto(event.result());
     }