about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorTimothy DeHerrera <tim.deh@pm.me>2021-07-03 13:54:00 -0600
committerTimothy DeHerrera <tim.deh@pm.me>2021-07-21 15:55:25 -0600
commit6dbf8c04097c8961bb1cb9cb319fee42eb19ab7a (patch)
treec0a50704a2c82d0385bba8cded72f9934ddb3d23 /nixos
parent9ad645dce8e11a3ffcf27cd797abc99476c837f0 (diff)
zsh: include completions for nix-* commands
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/programs/zsh/zsh.nix20
1 files changed, 15 insertions, 5 deletions
diff --git a/nixos/modules/programs/zsh/zsh.nix b/nixos/modules/programs/zsh/zsh.nix
index 4eac7c8afbf68..e0335643b6e34 100644
--- a/nixos/modules/programs/zsh/zsh.nix
+++ b/nixos/modules/programs/zsh/zsh.nix
@@ -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";