hello! i’m wondering if anyone has any feedback regarding a feature i’ve been thinking about.
proposal
currently, nix develop executes all shellHook code using bash. nix develop’s flexibility and usefulness could be extended to other shells with the inclusion of two new mkShell attributes:
shellHookShell - the shell with which to run shellHook commands, and
shellPackages - packages to be made accessible before shellHook is run.
browsing this thread, i was a little surprised to see that this functionality hasn’t already been implemented.
motivation
as of right now, nix develop’s usage of bash can be inconvenient for developers who rely on other, more modern shells. this would reduce the overhead required to manually enter into one’s preferred shell via nix develop --command <desired shell>. it would also allow and encourage developers to more declaratively set up their non-bash shell environments.
the most prevalent existing workaround (aliasing nix develop with --command <desired shell>) is not ideal: not only does it add boilerplate, but shellHook commands are not applied to the spawned instance of the desired shell, inadvertently reducing declarativity.
usage mockup
flake.nix snippet
pkgs.mkShell {
name = "example_shell";
shellPackages = [ pkgs.fish ];
shellHookShell = pkgs.fish;
shellHook = ''
echo "hello from fish :3"
'';
}
questions
does this seem like something that could be reasonably implemented?
ultimately, is this something that i should pursue/consider making an RFC for?