Fish: Difference between revisions
imported>Haemeah m better link for option reference |
imported>Cyounkins Adding section Setting fish as your shell |
||
Line 3: | Line 3: | ||
== Installation == | == Installation == | ||
A basic user-specific installation with [[Home Manager]] may look like this: | A basic user-specific installation with [[Home Manager]] may look like this: | ||
Line 21: | Line 19: | ||
programs.fish.enable = true; | programs.fish.enable = true; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Setting fish as your shell == | |||
Warning! [https://fishshell.com/docs/current/index.html#default-shell As noted in the fish documentation], using fish as your *login* shell (referenced in <code>/etc/passwd</code>) may cause issues because fish is not POSIX compliant. In particular, this author found systemd's emergency mode to be completely broken when fish was set as the login shell. | |||
This issue is discussed extensively on the [https://wiki.gentoo.org/wiki/Fish#Caveats Gentoo] and [https://wiki.archlinux.org/title/Fish#System_integration Arch] wikis. There they present an alternative, keeping bash as the system shell but having it exec fish when run interactively. | |||
Here is one solution, which launches fish unless the parent process is already fish: | |||
<syntaxhighlight lang="nix"> | |||
programs.bash = { | |||
interactiveShellInit = '' | |||
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] | |||
then | |||
shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" | |||
exec ${pkgs.fish}/bin/fish $LOGIN_OPTION | |||
fi | |||
''; | |||
}; | |||
</syntaxhighlight> | |||
If you still want to set fish as the login shell, see [[Command Shell#Changing default shell]]. | |||
== Configuration == | == Configuration == |