environment.shellAliases not honored for `ls`
Issue description
Defining a shell alias using config.environment.shellAliases for the ls command is not honored, due to this being defined afterwards: https://github.com/NixOS/nixpkgs/blob/56904d7c423f2b13b37fbd29f39bbb4b52bc7824/nixos/modules/programs/shell.nix#L17-L21
Steps to reproduce
Try overriding config.environment.shellAliases = { ls = "..." };
Technical details
- system:
"x86_64-linux" - host os:
Linux 4.9.84, NixOS, 18.03pre130151.268d99b1fe4 (Impala) - multi-user?:
yes - sandbox:
yes - version:
nix-env (Nix) 1.11.16 - channels(root):
"nixos-18.03pre130151.268d99b1fe4" - channels(mfiano):
"nixos-17.09-17.09.3101.fd1d76bb1a8" - nixpkgs:
/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs
Are you sure? I have the following working as expected on nixos-17.09 and nixos-unstable with bash and zsh.
config.environment.shellAliases = { ls = "ls --color=tty -F" };
Yes, I'm sure. I have a pile of aliases defined in config.environment.shellAliases, and ls is the only one that is not correct -- it's exactly what is defined in the above link.
If you use zsh, then environment.shellAliases is not used, you have to add it yourself which is counterintuitive IMO.
This is bash, and all of my environment.shellAliases are being used except the one for ls is instead aliased to be that of the above link in the nixpkgs source.
That's because shellAliases are defined as attrs
https://github.com/NixOS/nixpkgs/blob/7e40287d00e39bed522c59da805d20c298699411/nixos/modules/programs/bash/bash.nix#L64
And merge function for attrs type replaces configuration attributes with default:
https://github.com/NixOS/nixpkgs/blob/7e40287d00e39bed522c59da805d20c298699411/lib/types.nix#L149
Merge function should work the other way round - replace default values with configuration
Solved with https://github.com/NixOS/nixpkgs/pull/44441