Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nix-repl] Show which variables get loaded #11404

Open
kstrafe opened this issue Sep 2, 2024 · 3 comments
Open

[nix-repl] Show which variables get loaded #11404

kstrafe opened this issue Sep 2, 2024 · 3 comments
Labels
feature Feature request or proposal repl The Read Eval Print Loop, "nix repl" command and debugger

Comments

@kstrafe
Copy link

kstrafe commented Sep 2, 2024

It's not practical to run nix repl nixpkgs and only get "Added 6 variables". This does not tell me which variables. I have to run the output against a plain nix repl, perform tab completion, and then diff these two outputs.

I'd like to just print the variables which were just loaded into the global scope.

@kstrafe kstrafe added the feature Feature request or proposal label Sep 2, 2024
@pbsds
Copy link
Member

pbsds commented Sep 2, 2024

should be capped

$ nix repl '<nixpkgs>'
warning: future versions of Lix will require using `--file` to load a file
Lix 2.90.0
Type :? for help.
Loading installable ''...
Added 21545 variables.

@kstrafe
Copy link
Author

kstrafe commented Sep 2, 2024

@pbsds Good point. Perhaps we should add a command for getting the most recently loaded variables and show these in a pager.

@kstrafe
Copy link
Author

kstrafe commented Sep 2, 2024

PR #11406

kstrafe added a commit to kstrafe/nix that referenced this issue Sep 2, 2024
Invoking `:ll` will start a pager with all variables which have just
been loaded by `:lf`, `:l`, or by a flake provided to `nix repl` as an
argument.

NixOS#11404
kstrafe added a commit to kstrafe/nix that referenced this issue Sep 2, 2024
Invoking `:ll` will start a pager with all variables which have just
been loaded by `:lf`, `:l`, or by a flake provided to `nix repl` as an
argument.

NixOS#11404
kstrafe added a commit to kstrafe/nix that referenced this issue Sep 3, 2024
Invoking `:ll` will start a pager with all variables which have just
been loaded by `:lf`, `:l`, or by a flake provided to `nix repl` as an
argument.

NixOS#11404
kstrafe added a commit to kstrafe/nix that referenced this issue Sep 3, 2024
Invoking `:ll` will start a pager with all variables which have just
been loaded by `:lf`, `:l`, or by a flake provided to `nix repl` as an
argument.

NixOS#11404
kstrafe added a commit to kstrafe/nix that referenced this issue Sep 3, 2024
Invoking `:ll` will start a pager with all variables which have just
been loaded by `:lf`, `:l`, or by a flake provided to `nix repl` as an
argument.

NixOS#11404
@fricklerhandwerk fricklerhandwerk added nix-shell nix-shell, nix develop, nix print-dev-env, etc repl The Read Eval Print Loop, "nix repl" command and debugger and removed nix-shell nix-shell, nix develop, nix print-dev-env, etc labels Sep 4, 2024
kstrafe added a commit to kstrafe/nix that referenced this issue Sep 21, 2024
When we run `nix repl nixpkgs` we get "Added 6 variables". This is not
useful as it doesn't tell us which variables the flake has exported to
our global repl scope.

This patch prints the name of each variable that was just loaded. We
currently cap printing to 10 variables in order to avoid excessive
prints.

NixOS#11404
kstrafe added a commit to kstrafe/nix that referenced this issue Sep 21, 2024
Invoking `:ll` will start a pager with all variables which have just
been loaded by `:lf`, `:l`, or by a flake provided to `nix repl` as an
argument.

NixOS#11404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request or proposal repl The Read Eval Print Loop, "nix repl" command and debugger
Projects
None yet
Development

No branches or pull requests

3 participants