mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 17:46:15 +02:00
Fix building against current Nix master
This commit is contained in:
parent
02b66e97ba
commit
89f9c0d41b
2 changed files with 25 additions and 7 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
with import nixpkgs { inherit system; };
|
with import nixpkgs { inherit system; };
|
||||||
|
|
||||||
|
let nix = nixUnstable; in
|
||||||
|
|
||||||
runCommand "nix-repl"
|
runCommand "nix-repl"
|
||||||
{ buildInputs = [ readline nix boehmgc ]; }
|
{ buildInputs = [ readline nix boehmgc ]; }
|
||||||
''
|
''
|
||||||
|
|
28
nix-repl.cc
28
nix-repl.cc
|
@ -39,7 +39,7 @@ struct NixRepl
|
||||||
StringSet::iterator curCompletion;
|
StringSet::iterator curCompletion;
|
||||||
|
|
||||||
NixRepl();
|
NixRepl();
|
||||||
void mainLoop(const Strings & args);
|
void mainLoop(const Strings & files);
|
||||||
void completePrefix(string prefix);
|
void completePrefix(string prefix);
|
||||||
bool getLine(string & line);
|
bool getLine(string & line);
|
||||||
bool processLine(string line);
|
bool processLine(string line);
|
||||||
|
@ -82,11 +82,11 @@ NixRepl::NixRepl()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NixRepl::mainLoop(const Strings & args)
|
void NixRepl::mainLoop(const Strings & files)
|
||||||
{
|
{
|
||||||
std::cout << "Welcome to Nix version " << NIX_VERSION << ". Type :? for help." << std::endl << std::endl;
|
std::cout << "Welcome to Nix version " << NIX_VERSION << ". Type :? for help." << std::endl << std::endl;
|
||||||
|
|
||||||
foreach (Strings::const_iterator, i, args)
|
foreach (Strings::const_iterator, i, files)
|
||||||
loadedFiles.push_back(*i);
|
loadedFiles.push_back(*i);
|
||||||
|
|
||||||
reloadFiles();
|
reloadFiles();
|
||||||
|
@ -590,8 +590,24 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void run(Strings args)
|
int main(int argc, char * * argv)
|
||||||
{
|
{
|
||||||
NixRepl repl;
|
return handleExceptions(argv[0], [&]() {
|
||||||
repl.mainLoop(args);
|
initNix();
|
||||||
|
|
||||||
|
Strings files;
|
||||||
|
|
||||||
|
parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) {
|
||||||
|
if (*arg == "--version")
|
||||||
|
printVersion("nix-repl");
|
||||||
|
else if (*arg != "" && arg->at(0) == '-')
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
files.push_back(*arg);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
NixRepl repl;
|
||||||
|
repl.mainLoop(files);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue