1
1
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-09-11 12:49:18 +03:00

zsh: add programs.zsh.shellAliases option

This commit is contained in:
Alyssa Ross 2018-08-23 21:14:44 +01:00
parent 90c34df929
commit 2ea0c9d929
No known key found for this signature in database
GPG Key ID: C4844408C0657052

View File

@ -5,6 +5,9 @@ with lib;
let
cfg = config.programs.zsh;
zshAliases =
mapAttrsToList (n: v: ''alias ${n}="${v}"'') cfg.shellAliases;
zshVariables =
mapAttrsToList (n: v: ''${n}="${v}"'') cfg.variables;
@ -21,6 +24,16 @@ in
description = "Whether to configure zsh as an interactive shell.";
};
programs.zsh.shellAliases = mkOption {
type = types.attrs;
default = config.environment.shellAliases;
description = ''
Set of aliases for zsh shell. Overrides the default value taken from
<option>environment.shellAliases</option>.
See <option>environment.shellAliases</option> for an option format description.
'';
};
programs.zsh.variables = mkOption {
type = types.attrsOf (types.either types.str (types.listOf types.str));
default = {};
@ -178,6 +191,8 @@ in
fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions)
done
${concatStringsSep "\n" zshAliases}
${cfg.promptInit}
${optionalString cfg.enableCompletion "autoload -U compinit && compinit"}