Fish: Difference between revisions

Dasj19 (talk | contribs)
Added example of using 3rd party fish plugins on plain NixOS
m The dconf path and the fish command was incorrect. I have corrected the case to make it work.
(8 intermediate revisions by 6 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 the [[#section Setting fish as default shell|Setting fish as default shell]] section for recommendations and mitigations.}}
{{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 71: Line 71:
     grc
     grc
     # Use 3rd-party fish plugins manually packaged.
     # Use 3rd-party fish plugins manually packaged.
     pkgs.callPackage ../fish-colored-man.nix {buildFishPlugin = pkgs.fishPlugins.buildFishPlugin; } )
     (pkgs.callPackage ../fish-colored-man.nix {buildFishPlugin = pkgs.fishPlugins.buildFishPlugin; } )
   ];
   ];
</nowiki>
</nowiki>
}}
|name=/etc/nixos/configuration.nix|lang=nix}}
Example of a file containing the definition of a fish plugin.
Example of a file containing the definition of a fish plugin.
{{file|/etc/nixos/fish-colored-man.nix|nix|
{{file|/etc/nixos/fish-colored-man.nix|nix|
Line 152: 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 ====