Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nix
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 88f4f0231b80
Choose a base ref
...
head repository: NixOS/nix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c129fc6ee8a8
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Jan 26, 2018

  1. remote_store: register for NIX_REMOTE=unix://path

    This allows overriding the socket path so the daemon may be listening at
    an arbitrary Unix domain socket location.
    
    Fixes #1800
    catern committed Jan 26, 2018
    Copy the full SHA
    746f8ae View commit details

Commits on Jan 31, 2018

  1. Merge pull request #1801 from catern/master

    remote_store: register for NIX_REMOTE=unix://path
    edolstra authored Jan 31, 2018

    Verified

    This commit was signed with the committer’s verified signature.
    Copy the full SHA
    c129fc6 View commit details
Showing with 26 additions and 2 deletions.
  1. +24 −2 src/libstore/remote-store.cc
  2. +2 −0 src/libstore/remote-store.hh
26 changes: 24 additions & 2 deletions src/libstore/remote-store.cc
Original file line number Diff line number Diff line change
@@ -78,9 +78,22 @@ UDSRemoteStore::UDSRemoteStore(const Params & params)
}


UDSRemoteStore::UDSRemoteStore(std::string socket_path, const Params & params)
: Store(params)
, LocalFSStore(params)
, RemoteStore(params)
, path(socket_path)
{
}


std::string UDSRemoteStore::getUri()
{
return "daemon";
if (path) {
return std::string("unix://") + *path;
} else {
return "daemon";
}
}


@@ -98,7 +111,7 @@ ref<RemoteStore::Connection> UDSRemoteStore::openConnection()
throw SysError("cannot create Unix domain socket");
closeOnExec(conn->fd.get());

string socketPath = settings.nixDaemonSocketFile;
string socketPath = path ? *path : settings.nixDaemonSocketFile;

struct sockaddr_un addr;
addr.sun_family = AF_UNIX;
@@ -721,5 +734,14 @@ void RemoteStore::Connection::processStderr(Sink * sink, Source * source)
}
}

static std::string uriScheme = "unix://";

static RegisterStoreImplementation regStore([](
const std::string & uri, const Store::Params & params)
-> std::shared_ptr<Store>
{
if (std::string(uri, 0, uriScheme.size()) != uriScheme) return 0;
return std::make_shared<UDSRemoteStore>(std::string(uri, uriScheme.size()), params);
});

}
2 changes: 2 additions & 0 deletions src/libstore/remote-store.hh
Original file line number Diff line number Diff line change
@@ -134,6 +134,7 @@ class UDSRemoteStore : public LocalFSStore, public RemoteStore
public:

UDSRemoteStore(const Params & params);
UDSRemoteStore(std::string path, const Params & params);

std::string getUri() override;

@@ -145,6 +146,7 @@ private:
};

ref<RemoteStore::Connection> openConnection() override;
std::experimental::optional<std::string> path;
};