Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set an alias in nixos?

Tags:

alias

nixos

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?

like image 365
mherzl Avatar asked Jul 11 '17 00:07

mherzl


2 Answers

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

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

like image 60
iElectric Avatar answered Oct 31 '22 17:10

iElectric


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

like image 39
ilyak Avatar answered Oct 31 '22 15:10

ilyak