forked from lix-project/lix
Rebecca Turner
727b43478c
Adds a `repl-overlays` option, which specifies files that can overlay
and modify the top-level bindings in `nix repl`. For example, with the
following contents in `~/.config/nix/repl.nix`:
info: final: prev: let
optionalAttrs = predicate: attrs:
if predicate
then attrs
else {};
in
optionalAttrs (prev ? legacyPackages && prev.legacyPackages ? ${info.currentSystem})
{
pkgs = prev.legacyPackages.${info.currentSystem};
}
We can run `nix repl` and use `pkgs` to refer to `legacyPackages.${currentSystem}`:
$ nix repl --repl-overlays ~/.config/nix/repl.nix nixpkgs
Lix 2.90.0
Type :? for help.
Loading installable 'flake:nixpkgs#'...
Added 5 variables.
Loading 'repl-overlays'...
Added 6 variables.
nix-repl> pkgs.bash
«derivation /nix/store/g08b5vkwwh0j8ic9rkmd8mpj878rk62z-bash-5.2p26.drv»
Change-Id: Ic12e0f2f210b2f46e920c33088dfe1083f42391a
22 lines
889 B
Text
22 lines
889 B
Text
`repl-overlays` that fail to evaluate should error.
|
|
@args --repl-overlays
|
|
@args ${PWD}/extra_data/repl-overlay-fail.nix
|
|
@should-start false
|
|
error:
|
|
… while calling the 'foldl'' builtin
|
|
at «string»:5:13:
|
|
4| functions:
|
|
5| let final = builtins.foldl'
|
|
| ^
|
|
6| (prev: function: prev // (function info final prev))
|
|
|
|
… in the right operand of the update (//) operator
|
|
at «string»:6:37:
|
|
5| let final = builtins.foldl'
|
|
6| (prev: function: prev // (function info final prev))
|
|
| ^
|
|
7| initial
|
|
|
|
(stack trace truncated; use '--show-trace' to show the full trace)
|
|
|
|
error: evaluation aborted with the following error message: 'uh oh!'
|