diff --git a/third_party/nix/src/libstore/store-api.cc b/third_party/nix/src/libstore/store-api.cc index fc33c7ce5..3ada63532 100644 --- a/third_party/nix/src/libstore/store-api.cc +++ b/third_party/nix/src/libstore/store-api.cc @@ -1,6 +1,8 @@ #include "libstore/store-api.hh" #include +#include +#include #include #include @@ -23,6 +25,17 @@ namespace nix { +namespace { +class NullStream : public std::streambuf { + public: + int overflow(int c) override { return c; } +}; + +static NullStream NULL_STREAM{}; +} // namespace + +std::ostream DiscardLogsSink() { return std::ostream(&NULL_STREAM); } + std::optional BuildModeFrom(nix::proto::BuildMode mode) { switch (mode) { case nix::proto::BuildMode::Normal: diff --git a/third_party/nix/src/libstore/store-api.hh b/third_party/nix/src/libstore/store-api.hh index b1c0b50de..39769dfb3 100644 --- a/third_party/nix/src/libstore/store-api.hh +++ b/third_party/nix/src/libstore/store-api.hh @@ -19,6 +19,12 @@ namespace nix { +// Create a no-op stream buffer used to discard build output in cases +// where we don't have a build log sink to thread through. +// +// TODO(tazjin): Get rid of this and do *something* with those logs. +std::ostream DiscardLogsSink(); + MakeError(SubstError, Error); MakeError(BuildError, Error); /* denotes a permanent build failure */ MakeError(InvalidPath, Error);