8

In ubuntu I had a ~/.bashrc file with a number of aliases of the form

alias gs='git status'

How do I set an alias in nixos?

mherzl
  • 5,624
  • 6
  • 34
  • 75
  • 1
    You still can use `.bashrc`, see this related [answer](https://unix.stackexchange.com/a/377663/23003) – wizzup Jul 11 '17 at 12:55

2 Answers2

12
environment.interactiveShellInit = ''
  alias gs='git status'
'';

More: https://nixos.org/manual/nixos/stable/options.html#opt-environment.interactiveShellInit

Eleanor Holley
  • 691
  • 1
  • 7
  • 27
iElectric
  • 5,633
  • 1
  • 29
  • 31
8

You can set programs.bash.shellAliases in your global configuration:

programs.bash.shellAliases = {
  l = "ls -alh";
  ll = "ls -l";
  ls = "ls --color=tty";
}

In general, one can search for configuration options at https://nixos.org/nixos/options.html

Ilya Kolpakov
  • 196
  • 2
  • 8