mirror of
https://github.com/NixOS/nix
synced 2025-06-28 01:11:15 +02:00
Merge branch 'master' into nix-repl-flakes
This commit is contained in:
commit
ffd41d1757
64 changed files with 1780 additions and 537 deletions
|
@ -86,6 +86,11 @@ ref<Store> CopyCommand::getDstStore()
|
|||
|
||||
EvalCommand::EvalCommand()
|
||||
{
|
||||
addFlag({
|
||||
.longName = "debugger",
|
||||
.description = "start an interactive environment if evaluation fails",
|
||||
.handler = {&startReplOnEvalErrors, true},
|
||||
});
|
||||
}
|
||||
|
||||
EvalCommand::~EvalCommand()
|
||||
|
@ -103,7 +108,7 @@ ref<Store> EvalCommand::getEvalStore()
|
|||
|
||||
ref<EvalState> EvalCommand::getEvalState()
|
||||
{
|
||||
if (!evalState)
|
||||
if (!evalState) {
|
||||
evalState =
|
||||
#if HAVE_BOEHMGC
|
||||
std::allocate_shared<EvalState>(traceable_allocator<EvalState>(),
|
||||
|
@ -113,6 +118,11 @@ ref<EvalState> EvalCommand::getEvalState()
|
|||
searchPath, getEvalStore(), getStore())
|
||||
#endif
|
||||
;
|
||||
|
||||
if (startReplOnEvalErrors) {
|
||||
evalState->debugRepl = &runRepl;
|
||||
};
|
||||
}
|
||||
return ref<EvalState>(evalState);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ struct CopyCommand : virtual StoreCommand
|
|||
|
||||
struct EvalCommand : virtual StoreCommand, MixEvalArgs
|
||||
{
|
||||
bool startReplOnEvalErrors = false;
|
||||
|
||||
EvalCommand();
|
||||
|
||||
~EvalCommand();
|
||||
|
@ -271,4 +273,8 @@ void printClosureDiff(
|
|||
const StorePath & afterPath,
|
||||
std::string_view indent);
|
||||
|
||||
|
||||
void runRepl(
|
||||
ref<EvalState> evalState,
|
||||
const ValMap & extraEnv);
|
||||
}
|
||||
|
|
|
@ -623,7 +623,14 @@ std::tuple<std::string, FlakeRef, InstallableValue::DerivationInfo> InstallableF
|
|||
std::set<std::string> outputsToInstall;
|
||||
std::optional<NixInt> priority;
|
||||
|
||||
if (auto aMeta = attr->maybeGetAttr(state->sMeta)) {
|
||||
if (auto aOutputSpecified = attr->maybeGetAttr(state->sOutputSpecified)) {
|
||||
if (aOutputSpecified->getBool()) {
|
||||
if (auto aOutputName = attr->maybeGetAttr("outputName"))
|
||||
outputsToInstall = { aOutputName->getString() };
|
||||
}
|
||||
}
|
||||
|
||||
else if (auto aMeta = attr->maybeGetAttr(state->sMeta)) {
|
||||
if (auto aOutputsToInstall = aMeta->maybeGetAttr("outputsToInstall"))
|
||||
for (auto & s : aOutputsToInstall->getListOfStrings())
|
||||
outputsToInstall.insert(s);
|
||||
|
|
|
@ -6,9 +6,9 @@ libcmd_DIR := $(d)
|
|||
|
||||
libcmd_SOURCES := $(wildcard $(d)/*.cc)
|
||||
|
||||
libcmd_CXXFLAGS += -I src/libutil -I src/libstore -I src/libexpr -I src/libmain -I src/libfetchers
|
||||
libcmd_CXXFLAGS += -I src/libutil -I src/libstore -I src/libexpr -I src/libmain -I src/libfetchers -I src/nix
|
||||
|
||||
libcmd_LDFLAGS += $(LOWDOWN_LIBS) -pthread
|
||||
libcmd_LDFLAGS = $(EDITLINE_LIBS) -llowdown -pthread
|
||||
|
||||
libcmd_LIBS = libstore libutil libexpr libmain libfetchers
|
||||
|
||||
|
|
1119
src/libcmd/repl.cc
Normal file
1119
src/libcmd/repl.cc
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue