Open scottTomaszewski opened 2 weeks ago
I think this is a really good suggestion, and it would help with some shell incompatibility bugs we've seen in the past.
I think I would tweak the proposal to allow the user to specify a shell package they want to install and use as well. For example (not final):
"shell": {
"package": "bash@5.1"
"exec": {
"shell": "bash --rcfile something.bash",
"run": "BASH_ENV=something.bash bash -c"
},
Would install Bash 5.1 from nixpkgs and then run shell/commands/services in that shell. This way you could write zsh/bash/fish specific scripts, and have it work across systems regardless of the user's host shell.
What problem are you trying to solve?
In the
init_hook
I would like to source some scripts containing helper utilities that are written in bash. Indevbox run
the shell issh
whereasdevbox shell
the shell is inherited from the caller's shell.This behavior was confirmed in discord:
which make sense, but if I wanted a consistent shell environment across both
devbox shell
anddevbox run
it would be nice to have a way to set that.More discussion:
What solution would you like?
Ideally, the solution would be to have support for overriding the default shell for
devbox shell
anddevbox run
. For (a contrived) example:.shell.exec.shell
and.shell.exec.run
allows for flexibility, but if even without the split my use case is satisfied--pure
flag is automatically setAlternatives you've considered
SHELL
in the devbox.jsonenv
(no effect)chsh
in theinit_hook
(requires password or mucking with global filesystem)eval bash
,bash -l
, and other means to starting the desired shell (creates a subshell which doesnt run thedevbox run
scripts)bash
as a package, I should be able to use it in scripts)bash
to force the shell (verbose and problematic with the creation of subshells)