nixos/shells: programs.*sh.shellAliases override environment.shellAliases

This commit is contained in:
Mitsuhiro Nakamura 2018-08-04 12:32:30 +09:00
parent e4e160cc39
commit 3b5449b80c
3 changed files with 17 additions and 12 deletions

View file

@ -59,12 +59,12 @@ in
*/ */
shellAliases = mkOption { shellAliases = mkOption {
default = config.environment.shellAliases; default = {};
description = '' description = ''
Set of aliases for bash shell. See <option>environment.shellAliases</option> Set of aliases for bash shell, which overrides <option>environment.shellAliases</option>.
for an option format description. See <option>environment.shellAliases</option> for an option format description.
''; '';
type = types.attrs; # types.attrsOf types.stringOrPath; type = with types; attrsOf (either str path);
}; };
shellInit = mkOption { shellInit = mkOption {
@ -125,6 +125,8 @@ in
programs.bash = { programs.bash = {
shellAliases = mapAttrs (name: mkDefault) cfge.shellAliases;
shellInit = '' shellInit = ''
if [ -z "$__NIXOS_SET_ENVIRONMENT_DONE" ]; then if [ -z "$__NIXOS_SET_ENVIRONMENT_DONE" ]; then
. ${config.system.build.setEnvironment} . ${config.system.build.setEnvironment}

View file

@ -53,12 +53,12 @@ in
}; };
shellAliases = mkOption { shellAliases = mkOption {
default = config.environment.shellAliases; default = {};
description = '' description = ''
Set of aliases for fish shell. See <option>environment.shellAliases</option> Set of aliases for fish shell, which overrides <option>environment.shellAliases</option>.
for an option format description. See <option>environment.shellAliases</option> for an option format description.
''; '';
type = types.attrs; type = with types; attrsOf (either str path);
}; };
shellInit = mkOption { shellInit = mkOption {
@ -99,6 +99,8 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
programs.fish.shellAliases = mapAttrs (name: mkDefault) cfge.shellAliases;
environment.etc."fish/foreign-env/shellInit".text = cfge.shellInit; environment.etc."fish/foreign-env/shellInit".text = cfge.shellInit;
environment.etc."fish/foreign-env/loginShellInit".text = cfge.loginShellInit; environment.etc."fish/foreign-env/loginShellInit".text = cfge.loginShellInit;
environment.etc."fish/foreign-env/interactiveShellInit".text = cfge.interactiveShellInit; environment.etc."fish/foreign-env/interactiveShellInit".text = cfge.interactiveShellInit;

View file

@ -34,13 +34,12 @@ in
}; };
shellAliases = mkOption { shellAliases = mkOption {
default = config.environment.shellAliases; default = {};
description = '' description = ''
Set of aliases for zsh shell. Overrides the default value taken from Set of aliases for zsh shell, which overrides <option>environment.shellAliases</option>.
<option>environment.shellAliases</option>.
See <option>environment.shellAliases</option> for an option format description. See <option>environment.shellAliases</option> for an option format description.
''; '';
type = types.attrs; # types.attrsOf types.stringOrPath; type = with types; attrsOf (either str path);
}; };
shellInit = mkOption { shellInit = mkOption {
@ -106,6 +105,8 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
programs.zsh.shellAliases = mapAttrs (name: mkDefault) cfge.shellAliases;
environment.etc."zshenv".text = environment.etc."zshenv".text =
'' ''
# /etc/zshenv: DO NOT EDIT -- this file has been generated automatically. # /etc/zshenv: DO NOT EDIT -- this file has been generated automatically.