Command Shell: Difference between revisions
imported>Liassica →Changing the default shell: Expand on how to change the default shell |
Add category shell |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 24: | Line 24: | ||
=== For a specific user === | === For a specific user === | ||
To set a command shell as the default for a particular user, use the [https://search.nixos.org/options?query= | To set a command shell as the default for a particular user, use the [https://search.nixos.org/options?query=%3Cname%3E.shell <code><nowiki><name></nowiki>.shell</code>] option. | ||
For example, to set user "myuser"'s shell to [[fish]]: | For example, to set user "myuser"'s shell to [[fish]]: | ||
Line 37: | Line 37: | ||
users.users.myuser.useDefaultShell = true; | users.users.myuser.useDefaultShell = true; | ||
</nowiki>}} | </nowiki>}} | ||
== See also == | == See also == | ||
Line 55: | Line 45: | ||
[[Category:Configuration]] | [[Category:Configuration]] | ||
[[Category:Software]] | [[Category:Software]] | ||
[[Category:Shell]] |
Latest revision as of 08:21, 6 April 2024
A shell is a program that translates text commands (like ls
, vim
, reboot
etc) into instructions for your computer. The default shell on NixOS is bash, but it can be easily changed.
Enable
When adding a new shell, always enable the shell system-wide, even if it's already enabled in your Home Manager configuration, otherwise it won't source the necessary files.
For example, for Zsh:
/etc/nixos/configuration.nix
programs.zsh.enable = true;
Changing the default shell
For all users
To set a command shell as the default for all users, use the defaultUserShell
option.
For example, to set Zsh as the default user shell for all users:
/etc/nixos/configuration.nix
users.defaultUserShell = pkgs.zsh;
For a specific user
To set a command shell as the default for a particular user, use the <name>.shell
option.
For example, to set user "myuser"'s shell to fish:
/etc/nixos/configuration.nix
users.users.myuser.shell = pkgs.fish;
You can also choose whether or not a user should use the default shell:
/etc/nixos/configuration.nix
users.users.myuser.useDefaultShell = true;