Fish: Difference between revisions
Reorganized and polished content, added information about installing fish for those not using home manager Tags: Mobile edit Mobile web edit Advanced mobile edit |
Bitestring (talk | contribs) m The dconf path and the fish command was incorrect. I have corrected the case to make it work. |
||
| (10 intermediate revisions by 7 users not shown) | |||
| Line 20: | Line 20: | ||
Replace <code>myuser</code> with the appropriate username. | Replace <code>myuser</code> with the appropriate username. | ||
{{warning| [https://fishshell.com/docs/current/index.html#default-shell As noted in the fish documentation], using fish as your *login* shell (via <code>/etc/passwd</code>) may cause issues, particularly for the <code>root</code> user, because fish is not POSIX compliant. While using fish as the default shell for regular users is generaly safe, caution is still advised. See | {{warning| [https://fishshell.com/docs/current/index.html#default-shell As noted in the fish documentation], using fish as your *login* shell (via <code>/etc/passwd</code>) may cause issues, particularly for the <code>root</code> user, because fish is not POSIX compliant. While using fish as the default shell for regular users is generaly safe, caution is still advised. See [[#Setting fish as default shell]] for recommendations and mitigations.}} | ||
=== Home Manager === | === Home Manager === | ||
| Line 54: | Line 54: | ||
{{file|/etc/nixos/configuration.nix|nix| | {{file|/etc/nixos/configuration.nix|nix| | ||
<nowiki> | <nowiki> | ||
environment.systemPackages = with pkgs; [ | programs.fish = { | ||
enable = true; | |||
interactiveShellInit = '' | |||
set fish_greeting # Disable greeting | |||
''; | |||
}; | |||
environment.systemPackages = with pkgs; [ | |||
... | |||
]; | fishPlugins.done | ||
fishPlugins.fzf-fish | |||
fishPlugins.forgit | |||
fishPlugins.hydro | |||
fzf | |||
fishPlugins.grc | |||
grc | |||
# Use 3rd-party fish plugins manually packaged. | |||
(pkgs.callPackage ../fish-colored-man.nix {buildFishPlugin = pkgs.fishPlugins.buildFishPlugin; } ) | |||
]; | |||
</nowiki> | |||
|name=/etc/nixos/configuration.nix|lang=nix}} | |||
Example of a file containing the definition of a fish plugin. | |||
{{file|/etc/nixos/fish-colored-man.nix|nix| | |||
<nowiki> | |||
{ | |||
lib, | |||
buildFishPlugin, | |||
fetchFromGitHub, | |||
}: | |||
buildFishPlugin { | |||
pname = "fish-colored-man"; | |||
version = "0-unstable-20240416"; | |||
src = fetchFromGitHub { | |||
owner = "decors"; | |||
repo = "fish-colored-man"; | |||
rev = "1ad8fff696d48c8bf173aa98f9dff39d7916de0e"; | |||
hash = "sha256-uoZ4eSFbZlsRfISIkJQp24qPUNqxeD0JbRb/gVdRYlA="; | |||
}; | |||
} | |||
</nowiki> | </nowiki> | ||
}} | }} | ||
| Line 123: | Line 152: | ||
</nowiki> | </nowiki> | ||
}} | }} | ||
Note that if you use the copy button to the right of the above code block, there will be a unicode space before the <code>!=</code> on line 3 of the snippet that you will need to change to a non-unicode space before executing this in your shell. | |||
'''Setting fish as default for Gnome Console''' | |||
It is possible to set fish as the interactive non-login shell for Gnome Console without setting fish as the login shell (the login shell in /etc/passwd for your user will not be fish). | |||
{{File|3=home-manager.users.myuser = { | |||
dconf = { | |||
enable = true; | |||
settings."org/gnome/Console" = { | |||
shell = [ "fish" ]; | |||
}; | |||
}; | |||
};|name=home.nix|lang=nix}} | |||
If you still want to set fish as the login shell, see [[Command Shell#Changing the default shell]]. | If you still want to set fish as the login shell, see [[Command Shell#Changing the default shell]]. | ||
==== Disable man page generation ==== | |||
Some users suffer from slow build due to fish enabling `documentation.man.generateCaches`. You may force false. | |||
documentation.man.generateCaches = false'';'' | |||
For home-manager users, man cache need to be disabled in programs | |||
programs.man.generateCaches = false'';'' | |||
==== Running fish interactively with zsh as system shell on darwin ==== | ==== Running fish interactively with zsh as system shell on darwin ==== | ||