zsh: include completions for nix-* commands

This commit is contained in:
Timothy DeHerrera 2021-07-03 13:54:00 -06:00
parent 9ad645dce8
commit 6dbf8c0409
No known key found for this signature in database
GPG key ID: 19B7285E0F84A536

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";