Command Shell

From NixOS Wiki
Revision as of 05:47, 12 June 2021 by imported>Artturin (add enable)

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.

Note: Zsh is used here as an example. You can use other shells, eg fish.

Enable

Always enable the shell, otherwise it wont source the necessary files.

/etc/nixos/configuration.nix
programs.zsh.enable = true;

Changing default shell

Shells can be changed system-wide and per-user. To change the shell system-wide, add the following line to your config:

/etc/nixos/configuration.nix
users.defaultUserShell = pkgs.zsh;

then run nixos-rebuild switch and reboot your system.

To only change the default shell for one of the users, add

/etc/nixos/configuration.nix
users.users.yourname.shell = pkgs.zsh;

See also