Command Shell: Difference between revisions

imported>Liassica
Enable: Specify when to enable the shell and example line
imported>Liassica
Changing the default shell: Expand on how to change the default shell
Line 12: Line 12:
== Changing the default shell ==
== Changing the default shell ==


[https://search.nixos.org/options?query=defaultUserShell <code>defaultUserShell</code> in the options search]
=== For all users ===


[https://search.nixos.org/options?query=useDefaultShell <code>useDefaultShell</code> in the options search]
To set a command shell as the default for all users, use the [https://search.nixos.org/options?query=defaultUserShell <code>defaultUserShell</code>] option.


To only change the default shell for one of the users, see
For example, to set Zsh as the default user shell for all users:


[https://search.nixos.org/options?query=<name>.shell <code><name>.shell</code> in the options search]
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
users.defaultUserShell = pkgs.zsh;
</nowiki>}}
 
=== For a specific user ===
 
To set a command shell as the default for a particular user, use the [https://search.nixos.org/options?query=<name>.shell <code><name>.shell</code>] option.
 
For example, to set user "myuser"'s shell to [[fish]]:
 
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
users.users.myuser.shell = pkgs.fish;
</nowiki>}}
 
You can also choose whether or not a user should use the default shell:
 
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
users.users.myuser.useDefaultShell = true;
</nowiki>}}


== Changing /bin/sh ==
== Changing /bin/sh ==