mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
nix-daemon: Respect --store
For example, this allows you to do run nix-daemon as a non-privileged user: eelco$ NIX_STATE_DIR=~/my-nix/nix/var nix-daemon --store ~/my-nix/ The NIX_STATE_DIR is still needed because settings.nixDaemonSocketFile is not derived from settings.storeUri (and we can't derive it from the store's state directory because we don't want to open the store in the parent process).
This commit is contained in:
parent
ea3c9dab5f
commit
e388739098
1 changed files with 7 additions and 3 deletions
|
@ -233,7 +233,7 @@ struct RetrieveRegularNARSink : ParseSink
|
|||
};
|
||||
|
||||
|
||||
static void performOp(TunnelLogger * logger, ref<LocalStore> store,
|
||||
static void performOp(TunnelLogger * logger, ref<Store> store,
|
||||
bool trusted, unsigned int clientVersion,
|
||||
Source & from, Sink & to, unsigned int op)
|
||||
{
|
||||
|
@ -362,7 +362,11 @@ static void performOp(TunnelLogger * logger, ref<LocalStore> store,
|
|||
|
||||
logger->startWork();
|
||||
if (!savedRegular.regular) throw Error("regular file expected");
|
||||
Path path = store->addToStoreFromDump(recursive ? *savedNAR.data : savedRegular.s, baseName, recursive, hashAlgo);
|
||||
|
||||
auto store2 = store.dynamic_pointer_cast<LocalStore>();
|
||||
if (!store2) throw Error("operation is only supported by LocalStore");
|
||||
|
||||
Path path = store2->addToStoreFromDump(recursive ? *savedNAR.data : savedRegular.s, baseName, recursive, hashAlgo);
|
||||
logger->stopWork();
|
||||
|
||||
to << path;
|
||||
|
@ -776,7 +780,7 @@ static void processConnection(bool trusted)
|
|||
Store::Params params; // FIXME: get params from somewhere
|
||||
// Disable caching since the client already does that.
|
||||
params["path-info-cache-size"] = "0";
|
||||
auto store = make_ref<LocalStore>(params);
|
||||
auto store = openStore(settings.storeUri, params);
|
||||
|
||||
tunnelLogger->stopWork();
|
||||
to.flush();
|
||||
|
|
Loading…
Reference in a new issue