-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Sometimes I just want to paste a string into my shell and run it.
For example
nix-repl> config.system.activationScripts.check-manual-docbook
"if [[ $(cat /nix/store/zvzbmg408jbb7x60kdwndfv68x7mlcnj-options-used-docbook) = 1 ]]; then\n echo -e \"\\e[31mwarning\\e[0m: This configuration contains option documentation in docbook.\" \\\n \"Support for docbook is deprecated and will be removed after NixOS 23.05.\" \\\n \"See nix-store --read-log /nix/store/6vknjm2hbvqpwql7qp1dxhg4hbq5hs26-options.json.drv\"\nfi\n"
nix-repl> :b config.system.activationScripts.check-manual-docbook
error: expression does not evaluate to a derivation, so I can't build it
Describe the solution you'd like
In the repl, when :b evaluates its argument to a string, continue to build the string context. Maybe print the raw string? (ie not in string literal syntax)
In the cli, add a flag to build a string? An nix eval flag? A nix build flag?
e.g.
$ s=$(nix eval --raw --realise nixpkgs#hello.shellHook)
eval "$s"
or perhaps something like
$ s=$(nix build --stdout=string nixpkgs#hello.shellHook)
eval "$s"
or something like --print=raw or --print=json.
Describe alternatives you've considered
a. Keep digging through toplevel instead of building the option I wish to inspect.
b. Write ad hoc script builder in the repl. This is not the same, as the result is a bit harder to read, and the script derivation is slightly cumbersome to write.
Additional context
Priorities
Add 👍 to issues you find important.
Metadata
Metadata
Assignees
Labels
Projects
Status