Skip to content

:reload in the REPL removes everything loaded with :lf #8753

Open
@thufschmitt

Description

If a flake is loaded with :lf in the repl, then running :r will drop it from the environment rather than reloading it:

$ nix repl
Welcome to Nix 2.17.0pre20230720_85d0eb6. Type :? for help.

nix-repl> :lf nixpkgs    
Added 15 variables.

nix-repl> builtins.attrNames legacyPackages 
[ "aarch64-darwin" "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "i686-linux" "mipsel-linux" "powerpc64le-linux" "riscv64-linux" "x86_64-darwin" "x86_64-linux" ]

nix-repl> :r                                

nix-repl> builtins.attrNames legacyPackages
error: undefined variable 'legacyPackages'

       at «string»:1:20:

            1| builtins.attrNames legacyPackages
             |                    ^

This doesn't affect :l

Metadata

Assignees

No one assigned

    Labels

    bugreplThe Read Eval Print Loop, "nix repl" command and debugger

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions