diff options
author | Arseniy Seroka <jagajaga@users.noreply.github.com> | 2015-11-25 18:45:25 +0300 |
---|---|---|
committer | Arseniy Seroka <jagajaga@users.noreply.github.com> | 2015-11-25 18:45:25 +0300 |
commit | 451858bd34afa5aef36c945db3f00e41e5a0d999 (patch) | |
tree | 01f7c1a758d2c8c737731ed5b6ed6769beb21d89 /nixos | |
parent | 6610fd532973f8d6c63e2f70f63370b980ca9502 (diff) | |
parent | ff58711bda11e4f79fed80e209fd91cff3ff62ef (diff) |
Merge pull request #11251 from spwhitt/nix-zsh-completions
nix-zsh-completions package and module support
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/programs/zsh/zsh.nix | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/nixos/modules/programs/zsh/zsh.nix b/nixos/modules/programs/zsh/zsh.nix index 74dd6af0bddea..9f7596a21e725 100644 --- a/nixos/modules/programs/zsh/zsh.nix +++ b/nixos/modules/programs/zsh/zsh.nix @@ -25,7 +25,7 @@ in enable = mkOption { default = false; description = '' - Whenever to configure Zsh as an interactive shell. + Whether to configure zsh as an interactive shell. ''; type = types.bool; }; @@ -73,6 +73,14 @@ in type = types.lines; }; + enableCompletion = mkOption { + default = true; + description = '' + Enable zsh completion for all interactive zsh shells. + ''; + type = types.bool; + }; + }; }; @@ -101,6 +109,13 @@ in export HISTFILE=$HOME/.zsh_history setopt HIST_IGNORE_DUPS SHARE_HISTORY HIST_FCNTL_LOCK + + # Tell zsh how to find installed completions + for p in ''${(z)NIX_PROFILES}; do + fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions) + done + + ${if cfg.enableCompletion then "autoload -U compinit && compinit" else ""} ''; }; @@ -161,7 +176,8 @@ in environment.etc."zinputrc".source = ./zinputrc; - environment.systemPackages = [ pkgs.zsh ]; + environment.systemPackages = [ pkgs.zsh ] + ++ optional cfg.enableCompletion pkgs.nix-zsh-completions; #users.defaultUserShell = mkDefault "/run/current-system/sw/bin/zsh"; |