diff options
author | Tom Bereknyei <tomberek@gmail.com> | 2022-03-11 13:52:08 -0500 |
---|---|---|
committer | Tom Bereknyei <tomberek@gmail.com> | 2022-05-18 21:21:38 -0400 |
commit | 1ca3f6035da4e82647382405c774e43e02de3fa1 (patch) | |
tree | 94423882b0657ef9ca3a8c6ba4e2737e50a7ec87 | |
parent | 5640b528349c43717aa501797a4f337373ebf3e4 (diff) |
repl: update docs with installables
-rw-r--r-- | doc/manual/src/release-notes/rl-next.md | 5 | ||||
-rw-r--r-- | src/nix/repl.cc | 16 | ||||
-rw-r--r-- | src/nix/repl.md | 2 |
3 files changed, 9 insertions, 14 deletions
diff --git a/doc/manual/src/release-notes/rl-next.md b/doc/manual/src/release-notes/rl-next.md index efd893662..096499bc3 100644 --- a/doc/manual/src/release-notes/rl-next.md +++ b/doc/manual/src/release-notes/rl-next.md @@ -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>{}'` diff --git a/src/nix/repl.cc b/src/nix/repl.cc index b5ecc8ad0..ac0f1f4d7 100644 --- a/src/nix/repl.cc +++ b/src/nix/repl.cc @@ -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{ diff --git a/src/nix/repl.md b/src/nix/repl.md index be1498e5b..6a526f7d0 100644 --- a/src/nix/repl.md +++ b/src/nix/repl.md @@ -48,7 +48,7 @@ R""( nix-repl> :q - # nix repl --expr 'import <nixpkgs>{}' --impure + # nix repl --expr 'import <nixpkgs>{}' Loading Installable ''... Added 12439 variables. |