forked from lix-project/lix
fix nix-repl after we don't have a global store variable anymore (cf nix@c10c61449f954702ae6d8092120321744acd82ff)
This commit is contained in:
parent
a1ea85e92b
commit
ff8d0698c7
11
nix-repl.cc
11
nix-repl.cc
|
@ -38,7 +38,7 @@ struct NixRepl
|
||||||
StringSet completions;
|
StringSet completions;
|
||||||
StringSet::iterator curCompletion;
|
StringSet::iterator curCompletion;
|
||||||
|
|
||||||
NixRepl(const Strings & searchPath);
|
NixRepl(const Strings & searchPath, nix::ref<Store> store);
|
||||||
void mainLoop(const Strings & files);
|
void mainLoop(const Strings & files);
|
||||||
void completePrefix(string prefix);
|
void completePrefix(string prefix);
|
||||||
bool getLine(string & input, const char * prompt);
|
bool getLine(string & input, const char * prompt);
|
||||||
|
@ -73,8 +73,8 @@ string removeWhitespace(string s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NixRepl::NixRepl(const Strings & searchPath)
|
NixRepl::NixRepl(const Strings & searchPath, nix::ref<Store> store)
|
||||||
: state(searchPath)
|
: state(searchPath, store)
|
||||||
, staticEnv(false, &state.staticBaseEnv)
|
, staticEnv(false, &state.staticBaseEnv)
|
||||||
{
|
{
|
||||||
curDir = absPath(".");
|
curDir = absPath(".");
|
||||||
|
@ -334,7 +334,7 @@ bool NixRepl::processLine(string line)
|
||||||
if (!getDerivation(state, v, drvInfo, false))
|
if (!getDerivation(state, v, drvInfo, false))
|
||||||
throw Error("expression does not evaluation to a derivation, so I can't build it");
|
throw Error("expression does not evaluation to a derivation, so I can't build it");
|
||||||
Path drvPath = drvInfo.queryDrvPath();
|
Path drvPath = drvInfo.queryDrvPath();
|
||||||
if (drvPath == "" || !store->isValidPath(drvPath))
|
if (drvPath == "" || !state.store->isValidPath(drvPath))
|
||||||
throw Error("expression did not evaluate to a valid derivation");
|
throw Error("expression did not evaluate to a valid derivation");
|
||||||
|
|
||||||
if (command == ":b") {
|
if (command == ":b") {
|
||||||
|
@ -645,8 +645,7 @@ int main(int argc, char * * argv)
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
store = openStore();
|
NixRepl repl(searchPath, openStore());
|
||||||
NixRepl repl(searchPath);
|
|
||||||
repl.mainLoop(files);
|
repl.mainLoop(files);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue