-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
configuration file
#9940
Labels
feature
Feature request or proposal
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
When I'm entering the
nix repl
, I often like to set up a couple definitions for convenience before I start evaluating expressions, like this:Unfortunately, there's no way to configure this sort of behavior for
nix repl
, and even if there was a setting likerepl-default-bindings
it wouldn't account for the dynamism of the values that might be loaded.Describe the solution you'd like
I would like a
repl-startup-files
setting, which could default to a path like~/.config/nix/repl.nix
. The file would contain a function of typeAttrSet -> AttrSet
.nix repl
would call the file with the initial top-level variables as the first argument and replace the top-level variables with the resulting expression.Then, the bindings I've added manually above could be added automatically like this:
Perhaps we could also provide a global variable like
__replSource
to indicate which flake or file is being loaded. Then, users could dynamically provide bindings for specific flakes. Alternatively, flakes could setnixConfig.extraReplStartupFiles
to check in project-specific bindings.Describe alternatives you've considered
One alternative would be a
repl-bindings
setting, which might look like this:I think this would be much clumsier to use and would introduce another unfortunate whitespace-sensitive DSL. The lack of newlines in configuration files would also make it much harder to keep the definitions organized neatly.
Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: