zsh: include completions for nix-* commands

(cherry picked from commit 6dbf8c04097c8961bb1cb9cb319fee42eb19ab7a)
This commit is contained in:
Timothy DeHerrera 2021-07-03 13:54:00 -06:00 committed by github-actions[bot]
parent b16eb24c4d
commit 6322c5baf7
1 changed files with 15 additions and 5 deletions

View File

@ -280,11 +280,21 @@ in
environment.etc.zinputrc.source = ./zinputrc;
environment.systemPackages = [ pkgs.zsh ]
++ optional
(cfg.enableCompletion
&& !lib.versionAtLeast (lib.getVersion config.nix.package) "2.4pre")
pkgs.nix-zsh-completions;
environment.systemPackages =
let
completions =
if lib.versionAtLeast (lib.getVersion config.nix.package) "2.4pre"
then
pkgs.nix-zsh-completions.overrideAttrs
(_: {
postInstall = ''
rm $out/share/zsh/site-functions/_nix
'';
})
else pkgs.nix-zsh-completions;
in
[ pkgs.zsh ]
++ optional cfg.enableCompletion completions;
environment.pathsToLink = optional cfg.enableCompletion "/share/zsh";