mirror of
https://github.com/NixOS/nix.git
synced 2025-12-05 16:41:01 +01:00
Stores no longer inherit from their configs
Fix #10766 See that ticket for details. Progress (I hope!) towards #11139. Co-Authored-By: Sergei Zimmerman <xokdvium@proton.me>
This commit is contained in:
parent
f0f196cef0
commit
934918ba16
48 changed files with 743 additions and 593 deletions
|
|
@ -20,13 +20,13 @@ namespace nix {
|
|||
UDSRemoteStoreConfig::UDSRemoteStoreConfig(
|
||||
std::string_view scheme,
|
||||
std::string_view authority,
|
||||
const Params & params)
|
||||
: StoreConfig(params)
|
||||
, LocalFSStoreConfig(params)
|
||||
, RemoteStoreConfig(params)
|
||||
const StoreReference::Params & params)
|
||||
: Store::Config{params}
|
||||
, LocalFSStore::Config{params}
|
||||
, RemoteStore::Config{params}
|
||||
, path{authority.empty() ? settings.nixDaemonSocketFile : authority}
|
||||
{
|
||||
if (scheme != UDSRemoteStoreConfig::scheme) {
|
||||
if (uriSchemes().count(scheme) == 0) {
|
||||
throw UsageError("Scheme must be 'unix'");
|
||||
}
|
||||
}
|
||||
|
|
@ -44,32 +44,30 @@ std::string UDSRemoteStoreConfig::doc()
|
|||
// empty string will later default to the same nixDaemonSocketFile. Why
|
||||
// don't we just wire it all through? I believe there are cases where it
|
||||
// will live reload so we want to continue to account for that.
|
||||
UDSRemoteStore::UDSRemoteStore(const Params & params)
|
||||
: UDSRemoteStore(scheme, "", params)
|
||||
{}
|
||||
UDSRemoteStoreConfig::UDSRemoteStoreConfig(const Params & params)
|
||||
: UDSRemoteStoreConfig(*uriSchemes().begin(), "", params)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
UDSRemoteStore::UDSRemoteStore(std::string_view scheme, std::string_view authority, const Params & params)
|
||||
: StoreConfig(params)
|
||||
, LocalFSStoreConfig(params)
|
||||
, RemoteStoreConfig(params)
|
||||
, UDSRemoteStoreConfig(scheme, authority, params)
|
||||
, Store(params)
|
||||
, LocalFSStore(params)
|
||||
, RemoteStore(params)
|
||||
UDSRemoteStore::UDSRemoteStore(ref<const Config> config)
|
||||
: Store{*config}
|
||||
, LocalFSStore{*config}
|
||||
, RemoteStore{*config}
|
||||
, config{config}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
std::string UDSRemoteStore::getUri()
|
||||
{
|
||||
return path == settings.nixDaemonSocketFile
|
||||
return config->path == settings.nixDaemonSocketFile
|
||||
? // FIXME: Not clear why we return daemon here and not default
|
||||
// to settings.nixDaemonSocketFile
|
||||
//
|
||||
// unix:// with no path also works. Change what we return?
|
||||
"daemon"
|
||||
: std::string(scheme) + "://" + path;
|
||||
: std::string(*Config::uriSchemes().begin()) + "://" + config->path;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -86,7 +84,7 @@ ref<RemoteStore::Connection> UDSRemoteStore::openConnection()
|
|||
/* Connect to a daemon that does the privileged work for us. */
|
||||
conn->fd = createUnixDomainSocket();
|
||||
|
||||
nix::connect(toSocket(conn->fd.get()), path);
|
||||
nix::connect(toSocket(conn->fd.get()), config->path);
|
||||
|
||||
conn->from.fd = conn->fd.get();
|
||||
conn->to.fd = conn->fd.get();
|
||||
|
|
@ -106,6 +104,11 @@ void UDSRemoteStore::addIndirectRoot(const Path & path)
|
|||
}
|
||||
|
||||
|
||||
static RegisterStoreImplementation<UDSRemoteStore, UDSRemoteStoreConfig> regUDSRemoteStore;
|
||||
ref<Store> UDSRemoteStore::Config::openStore() const {
|
||||
return make_ref<UDSRemoteStore>(ref{shared_from_this()});
|
||||
}
|
||||
|
||||
|
||||
static RegisterStoreImplementation<UDSRemoteStore::Config> regUDSRemoteStore;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue