From 2304c145f342ae98968c1ea295f02c1183539ea3 Mon Sep 17 00:00:00 2001 From: Nikita Uvarov Date: Mon, 29 Jan 2018 11:30:26 +0100 Subject: [PATCH] zsh: add system packages' completion path to fpath --- modules/programs/zsh.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index 6706fa68a..a5163d87f 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -153,7 +153,13 @@ in enableCompletion = mkOption { default = true; - description = "Enable zsh completion."; + description = '' + Enable zsh completion. Don't forget to add + + environment.pathsToLink = [ "/share/zsh" ]; + + to your system configuration to get completion for system packages (e.g. systemd). + ''; type = types.bool; }; @@ -278,8 +284,10 @@ in home.file."${relToDotDir ".zshrc"}".text = '' typeset -U path cdpath fpath manpath - fpath+="$HOME/.nix-profile/share/zsh/site-functions" - fpath+="$HOME/.nix-profile/share/zsh/$ZSH_VERSION/functions" + + for profile in ''${(z)NIX_PROFILES}; do + fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions) + done HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help"