Talk:Fish
Suggested bashrc in Fish#Setting fish as default shell needs revision
This script seems to contain many unneeded parts, such as $BASH_EXECUTION_STRING and login_shell checks.
It also misses at least one needed safeguard: check if$SHLVL is greater than 1 or 2. Without it, nested nix-shell will not work correctly (since parent != fish check will not apply).
Seems like this script was initially adapted from ArchWiki Fish page. Right now i am working to clean up the corresponding section on ArchWiki.
Please, see https://wiki.archlinux.org/title/Fish#Modify_.bashrc_to_drop_into_fish and the respective Talk page there. There you'll find rationale for everything i've mentioned in this NixOS Wiki Talk page. Also you may check latest ArchWiki edit history for Fish page (I am also @Pigeon there).
Too many users copy-paste provided snippets from wiki without understanding how it works (i've done that myself). So i propose that make this script more accurate :-) Pigeon (talk) 18:40, 24 January 2026 (UTC)
- Hi, I'm the new @Pigeon. On my way to spare people from copy-pasting bad scripts from wikis :)
- I've updated the section in question in this edit. If the new version is worse, let's discuss here on how to fix and improve it. DHCP (talk) 21:20, 13 May 2026 (UTC)
- I'd like to propose removing the snippet entirely. The only safe approach, if you want to avoid setting fish as the login shell, is to configure your terminal emulator to launch your shell program of choice.
- The whole idea of `exec`-ing midway through bashrc is wildly unsafe. It silently breaks `nix develop` which sources the user's bashrc, it similarly breaks `devenv shell`, and it also disables any extra lines added to the NixOS option where it's used.
- We (devenv) get several reports a week from NixOS users blindly copy-pasting this snippet. They don't understand why things are broken or even what `exec` does. All they read from the snippet is — "this is how you replace bash with fish. The NixOS wiki recommends it." Sandydoo (talk) 15:11, 30 May 2026 (UTC)