:open REPL command to open the result of a derivation #1205

Open
opened 2026-05-04 09:46:15 +00:00 by blokyk · 0 comments
Member

Using the REPL, I often want to explore the resulting file/directory of a derivation. While for files it's possible to "hijack" :edit to do that, 1) you have to know in advance that the result is a file, and 2) it obviously doesn't work for directory.

Describe the solution you'd like

A specific command for opening the result of a derivation, named something like :open/:o or :explore/:x(/:ex?), which would:

  • open the result in a text editor, if the result is a non-binary (hehe) file
  • show the file type (or even just "/nix/store/...-foo is a binary file"), if the result is a binary file
  • open a shell in the resulting directory, if the result is a directory

Describe alternatives you've considered

Currently, I do this by building the derivation in the REPL with :build, copying the resulting path that's displayed, then opening a new terminal and cd'ing to it (or using file or nano depending on the derivation). This kind of sucks, and given how many commands in the REPL are... specialized tools (:b vs :bl vs :i vs :sh vs :u), I feel like this is a common enough scenario that it'd be reasonable to add another command.

## Is your feature request related to a problem? Please describe. Using the REPL, I often want to explore the resulting file/directory of a derivation. While for files it's possible to "hijack" `:edit` to do that, 1) you have to know in advance that the result is a file, and 2) it obviously doesn't work for directory. ## Describe the solution you'd like A specific command for opening the result of a derivation, named something like `:open`/`:o` or `:explore`/`:x`(/`:ex`?), which would: - open the result in a text editor, if the result is a non-binary (hehe) file - show the file type (or even just "/nix/store/...-foo is a binary file"), if the result is a binary file - open a shell in the resulting directory, if the result is a directory ## Describe alternatives you've considered Currently, I do this by building the derivation in the REPL with `:build`, copying the resulting path that's displayed, then opening a new terminal and `cd`'ing to it (or using `file` or `nano` depending on the derivation). This kind of sucks, and given how many commands in the REPL are... specialized tools (`:b` vs `:bl` vs `:i` vs `:sh` vs `:u`), I feel like this is a common enough scenario that it'd be reasonable to add another command.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lix-project/lix#1205
No description provided.