forked from lix-project/lix
Support --eval-store in nix-instantiate and nix-build
This commit is contained in:
parent
3d9de41a5b
commit
2ff3035cf4
|
@ -56,14 +56,6 @@ void StoreCommand::run()
|
||||||
|
|
||||||
EvalCommand::EvalCommand()
|
EvalCommand::EvalCommand()
|
||||||
{
|
{
|
||||||
// FIXME: move to MixEvalArgs?
|
|
||||||
addFlag({
|
|
||||||
.longName = "eval-store",
|
|
||||||
.description = "The Nix store to use for evaluations.",
|
|
||||||
.labels = {"store-url"},
|
|
||||||
//.category = ...,
|
|
||||||
.handler = {&evalStoreUrl},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EvalCommand::~EvalCommand()
|
EvalCommand::~EvalCommand()
|
||||||
|
|
|
@ -54,8 +54,6 @@ struct EvalCommand : virtual StoreCommand, MixEvalArgs
|
||||||
ref<EvalState> getEvalState();
|
ref<EvalState> getEvalState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::optional<std::string> evalStoreUrl;
|
|
||||||
|
|
||||||
std::shared_ptr<Store> evalStore;
|
std::shared_ptr<Store> evalStore;
|
||||||
|
|
||||||
std::shared_ptr<EvalState> evalState;
|
std::shared_ptr<EvalState> evalState;
|
||||||
|
|
|
@ -61,6 +61,14 @@ MixEvalArgs::MixEvalArgs()
|
||||||
fetchers::overrideRegistry(from.input, to.input, extraAttrs);
|
fetchers::overrideRegistry(from.input, to.input, extraAttrs);
|
||||||
}}
|
}}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addFlag({
|
||||||
|
.longName = "eval-store",
|
||||||
|
.description = "The Nix store to use for evaluations.",
|
||||||
|
.category = category,
|
||||||
|
.labels = {"store-url"},
|
||||||
|
.handler = {&evalStoreUrl},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Bindings * MixEvalArgs::getAutoArgs(EvalState & state)
|
Bindings * MixEvalArgs::getAutoArgs(EvalState & state)
|
||||||
|
|
|
@ -16,8 +16,9 @@ struct MixEvalArgs : virtual Args
|
||||||
|
|
||||||
Strings searchPath;
|
Strings searchPath;
|
||||||
|
|
||||||
private:
|
std::optional<std::string> evalStoreUrl;
|
||||||
|
|
||||||
|
private:
|
||||||
std::map<std::string, std::string> autoArgs;
|
std::map<std::string, std::string> autoArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -250,8 +250,9 @@ static void main_nix_build(int argc, char * * argv)
|
||||||
throw UsageError("'-p' and '-E' are mutually exclusive");
|
throw UsageError("'-p' and '-E' are mutually exclusive");
|
||||||
|
|
||||||
auto store = openStore();
|
auto store = openStore();
|
||||||
|
auto evalStore = myArgs.evalStoreUrl ? openStore(*myArgs.evalStoreUrl) : store;
|
||||||
|
|
||||||
auto state = std::make_unique<EvalState>(myArgs.searchPath, store);
|
auto state = std::make_unique<EvalState>(myArgs.searchPath, evalStore, store);
|
||||||
state->repair = repair;
|
state->repair = repair;
|
||||||
|
|
||||||
auto autoArgs = myArgs.getAutoArgs(*state);
|
auto autoArgs = myArgs.getAutoArgs(*state);
|
||||||
|
|
|
@ -153,6 +153,7 @@ static int main_nix_instantiate(int argc, char * * argv)
|
||||||
settings.readOnlyMode = true;
|
settings.readOnlyMode = true;
|
||||||
|
|
||||||
auto store = openStore();
|
auto store = openStore();
|
||||||
|
auto evalStore = myArgs.evalStoreUrl ? openStore(*myArgs.evalStoreUrl) : store;
|
||||||
|
|
||||||
auto state = std::make_unique<EvalState>(myArgs.searchPath, store);
|
auto state = std::make_unique<EvalState>(myArgs.searchPath, store);
|
||||||
state->repair = repair;
|
state->repair = repair;
|
||||||
|
|
Loading…
Reference in a new issue