repl: update docs with installables

This commit is contained in:
Tom Bereknyei 2022-03-11 13:52:08 -05:00
parent 5640b52834
commit 1ca3f6035d
3 changed files with 9 additions and 14 deletions

View file

@ -24,3 +24,8 @@
Selecting derivation outputs using the attribute selection syntax
(e.g. `nixpkgs#glibc.dev`) no longer works.
* `nix repl` now takes installables on the command line, unifying the usage
with other commands that use `--file` and `--expr`. Primary breaking change
is for the common usage of `nix repl '<nixpkgs>'` which can be recovered with
`nix repl nixpkgs` or `nix repl --expr 'import <nixpkgs>{}'`

View file

@ -73,7 +73,6 @@ struct NixRepl
StorePath getDerivationPath(Value & v);
bool processLine(std::string line);
void loadInstallable(Installable & installable);
void loadFile(const Path & path);
void loadFlake(const std::string & flakeRef);
void initEnv();
@ -634,12 +633,6 @@ bool NixRepl::processLine(std::string line)
return true;
}
void NixRepl::loadInstallable(Installable & installable)
{
auto [val, pos] = installable.toValue(*state);
addAttrsToScope(*val);
}
void NixRepl::loadFile(const Path & path)
{
loadedFiles.remove(path);
@ -899,6 +892,9 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
struct CmdRepl : InstallablesCommand
{
CmdRepl(){
evalSettings.pureEval = false;
}
std::vector<std::string> files;
Strings getDefaultFlakeAttrPaths()
override {
@ -908,10 +904,6 @@ struct CmdRepl : InstallablesCommand
return file.has_value() or expr.has_value();
}
CmdRepl()
{
}
std::string description() override
{
return "start an interactive environment for evaluating Nix expressions";
@ -926,8 +918,6 @@ struct CmdRepl : InstallablesCommand
void run(ref<Store> store) override
{
evalSettings.pureEval = false;
auto state = getEvalState();
auto repl = std::make_unique<NixRepl>(searchPath, openStore(),state
,[&]()->NixRepl::AnnotatedValues{

View file

@ -48,7 +48,7 @@ R""(
nix-repl> :q
# nix repl --expr 'import <nixpkgs>{}' --impure
# nix repl --expr 'import <nixpkgs>{}'
Loading Installable ''...
Added 12439 variables.