diff options
author | Scott Olson <scott@solson.me> | 2016-02-16T06·24-0600 |
---|---|---|
committer | Scott Olson <scott@solson.me> | 2016-02-16T06·36-0600 |
commit | 82aca33899a0348736604e6b6a601f9c7b4e0633 (patch) | |
tree | 2a8582029ed218891248e209f663d9f9578834e3 /nix-repl.cc | |
parent | 30a7bfbebe8582ab02f2a9b659403a5b3e1c097b (diff) |
Add :i command to install a package to the current profile.
It works by running `nix-env -i <derivation path>`. Fixes #15.
Diffstat (limited to 'nix-repl.cc')
-rw-r--r-- | nix-repl.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/nix-repl.cc b/nix-repl.cc index e753c637a755..ca221b033388 100644 --- a/nix-repl.cc +++ b/nix-repl.cc @@ -281,6 +281,7 @@ bool NixRepl::processLine(string line) << " <x> = <expr> Bind expression to variable\n" << " :a <expr> Add attributes from resulting set to scope\n" << " :b <expr> Build derivation\n" + << " :i <expr> Build derivation, then install result into current profile\n" << " :l <path> Load Nix expression and add it to scope\n" << " :p <expr> Evaluate and print expression recursively\n" << " :q Exit nix-repl\n" @@ -311,7 +312,7 @@ bool NixRepl::processLine(string line) std::cout << showType(v) << std::endl; } - else if (command == ":b" || command == ":s") { + else if (command == ":b" || command == ":i" || command == ":s") { Value v; evalString(arg, v); DrvInfo drvInfo(state); @@ -331,8 +332,11 @@ bool NixRepl::processLine(string line) for (auto & i : drv.outputs) std::cout << format(" %1% -> %2%") % i.first % i.second.path << std::endl; } - } else + } else if (command == ":i") { + runProgram("nix-env", Strings{"-i", drvPath}); + } else { runProgram("nix-shell", Strings{drvPath}); + } } else if (command == ":p" || command == ":print") { |