diff options
author | Spencer Whitt <me@swhitt.me> | 2015-11-24 18:04:17 -0500 |
---|---|---|
committer | Spencer Whitt <me@swhitt.me> | 2015-11-25 10:32:58 -0500 |
commit | ff58711bda11e4f79fed80e209fd91cff3ff62ef (patch) | |
tree | 9e4731d07cf13e65fbdbf9cbbeeabbe9dd5051e3 /nixos | |
parent | 0b0e51ce6f48662e75775a3ca52837c9a152d6b3 (diff) |
zsh module: add enableCompletion option
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"; |