diff --git a/third_party/nix/src/libstore/remote-store.cc b/third_party/nix/src/libstore/remote-store.cc index 784a95d2e..41881f8ef 100644 --- a/third_party/nix/src/libstore/remote-store.cc +++ b/third_party/nix/src/libstore/remote-store.cc @@ -69,56 +69,6 @@ ref RemoteStore::openConnectionWrapper() { } } -UDSRemoteStore::UDSRemoteStore(const Params& params) - : Store(params), LocalFSStore(params), RemoteStore(params) {} - -UDSRemoteStore::UDSRemoteStore(std::string socket_path, const Params& params) - : Store(params), - LocalFSStore(params), - RemoteStore(params), - path(socket_path) {} - -std::string UDSRemoteStore::getUri() { - if (path) { - return std::string("unix://") + *path; - } - return "daemon"; -} - -ref UDSRemoteStore::openConnection() { - auto conn = make_ref(); - - /* Connect to a daemon that does the privileged work for us. */ - conn->fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); - if (!conn->fd) { - throw SysError("cannot create Unix domain socket"); - } - closeOnExec(conn->fd.get()); - - std::string socketPath = path ? *path : settings.nixDaemonSocketFile; - - struct sockaddr_un addr; - addr.sun_family = AF_UNIX; - strncpy(addr.sun_path, socketPath.c_str(), sizeof(addr.sun_path)); - if (addr.sun_path[sizeof(addr.sun_path) - 1] != '\0') { - throw Error(format("socket path '%1%' is too long") % socketPath); - } - - if (::connect(conn->fd.get(), reinterpret_cast(&addr), - sizeof(addr)) == -1) { - throw SysError(format("cannot connect to daemon at '%1%'") % socketPath); - } - - conn->from.fd = conn->fd.get(); - conn->to.fd = conn->fd.get(); - - conn->startTime = std::chrono::steady_clock::now(); - - initConnection(*conn); - - return conn; -} - void RemoteStore::initConnection(Connection& conn) { /* Send the magic greeting, check for the reply. */ try { @@ -727,16 +677,4 @@ std::exception_ptr RemoteStore::Connection::processStderr(Sink* sink, return nullptr; } -static std::string uriScheme = "unix://"; - -static RegisterStoreImplementation regStore( - [](const std::string& uri, - const Store::Params& params) -> std::shared_ptr { - if (std::string(uri, 0, uriScheme.size()) != uriScheme) { - return nullptr; - } - return std::make_shared( - std::string(uri, uriScheme.size()), params); - }); - } // namespace nix diff --git a/third_party/nix/src/libstore/remote-store.hh b/third_party/nix/src/libstore/remote-store.hh index 927d08335..a6829226c 100644 --- a/third_party/nix/src/libstore/remote-store.hh +++ b/third_party/nix/src/libstore/remote-store.hh @@ -136,18 +136,4 @@ class RemoteStore : public virtual Store { std::atomic_bool failed{false}; }; -class UDSRemoteStore : public LocalFSStore, public RemoteStore { - public: - UDSRemoteStore(const Params& params); - UDSRemoteStore(std::string path, const Params& params); - - std::string getUri() override; - - bool sameMachine() override { return true; } - - private: - ref openConnection() override; - std::optional path; -}; - } // namespace nix