Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/libstore/include/nix/store/serve-protocol-connection.hh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ struct ServeProto::BasicClientConnection
BuildResult getBuildDerivationResponse(const StoreDirConfig & store);

void narFromPath(const StoreDirConfig & store, const StorePath & path, std::function<void(Source &)> fun);

void importPaths(const StoreDirConfig & store, std::function<void(Sink &)> fun);
};

struct ServeProto::BasicServerConnection
Expand Down
7 changes: 7 additions & 0 deletions src/libstore/include/nix/store/serve-protocol.hh
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ enum struct ServeProto::Command : uint64_t {
QueryValidPaths = 1,
QueryPathInfos = 2,
DumpStorePath = 3,
/**
* @note This is no longer used by Nix (as a client), but it is used
* by Hydra. We should therefore not remove it until Hydra no longer
* uses it either.
*/
ImportPaths = 4,
// ExportPaths = 5,
BuildPaths = 6,
QueryClosure = 7,
BuildDerivation = 8,
Expand Down
10 changes: 10 additions & 0 deletions src/libstore/serve-protocol-connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,14 @@ void ServeProto::BasicClientConnection::narFromPath(
fun(from);
}

void ServeProto::BasicClientConnection::importPaths(const StoreDirConfig & store, std::function<void(Sink &)> fun)
{
to << ServeProto::Command::ImportPaths;
fun(to);
to.flush();

if (readInt(from) != 1)
throw Error("remote machine failed to import closure");
}

} // namespace nix
10 changes: 10 additions & 0 deletions src/nix/nix-store/nix-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,16 @@ static void opServe(Strings opFlags, Strings opArgs)
store->narFromPath(store->parseStorePath(readString(in)), out);
break;

case ServeProto::Command::ImportPaths: {
if (!writeAllowed)
throw Error("importing paths is not allowed");
// FIXME: should we skip sig checking?
importPaths(*store, in, NoCheckSigs);
// indicate success
out << 1;
break;
}

case ServeProto::Command::BuildPaths: {

if (!writeAllowed)
Expand Down
Loading