lix/tests/functional/repl_characterization
Rebecca Turner 727b43478c Add repl-overlays
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
2024-04-08 17:11:47 -07:00
..
data Add repl-overlays 2024-04-08 17:11:47 -07:00
extra_data Add repl-overlays 2024-04-08 17:11:47 -07:00
.gitignore Implement a parser for a literate testing system for the repl 2024-03-14 14:30:38 -07:00
local.mk Implement a parser for a literate testing system for the repl 2024-03-14 14:30:38 -07:00
meson.build meson: run repl characterization test 2024-04-03 17:05:30 -06:00
repl_characterization.cc Add repl-overlays 2024-04-08 17:11:47 -07:00
test-session.cc Rewrite REPL test parser 2024-04-05 13:14:21 -07:00
test-session.hh Rewrite REPL test parser 2024-04-05 13:14:21 -07:00