[Nix#9940] nix repl
configuration file #62
Labels
No labels
Area/build-packaging
Area/evaluator
Area/flakes
Area/profiles
Area/remote-builds
Area/repl
Area/store
bug
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
RFD
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
ux
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#62
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Upstream-Issue: NixOS/nix#9940
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.
repl-overlays exists and fixes this.