From d687fe88fdbb00b89f4e5b82824c7b187659d648 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Tue, 29 Jun 2021 11:54:05 -0600 Subject: [PATCH 1/3] zsh: remove conflicting nixUnstable completions --- nixos/modules/programs/zsh/zsh.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/programs/zsh/zsh.nix b/nixos/modules/programs/zsh/zsh.nix index 049a315c7622..81f1395662a8 100644 --- a/nixos/modules/programs/zsh/zsh.nix +++ b/nixos/modules/programs/zsh/zsh.nix @@ -279,7 +279,7 @@ in environment.etc.zinputrc.source = ./zinputrc; environment.systemPackages = [ pkgs.zsh ] - ++ optional cfg.enableCompletion pkgs.nix-zsh-completions; + ++ optional (cfg.enableCompletion && ! lib.versionAtLeast (lib.getVersion config.nix.package) "2.4pre") pkgs.nix-zsh-completions; environment.pathsToLink = optional cfg.enableCompletion "/share/zsh"; From 9ad645dce8e11a3ffcf27cd797abc99476c837f0 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Tue, 29 Jun 2021 14:31:10 -0600 Subject: [PATCH 2/3] zsh: format module with nixpkgs-fmt --- nixos/modules/programs/zsh/zsh.nix | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/nixos/modules/programs/zsh/zsh.nix b/nixos/modules/programs/zsh/zsh.nix index 81f1395662a8..4eac7c8afbf6 100644 --- a/nixos/modules/programs/zsh/zsh.nix +++ b/nixos/modules/programs/zsh/zsh.nix @@ -53,7 +53,7 @@ in }; shellAliases = mkOption { - default = {}; + default = { }; description = '' Set of aliases for zsh shell, which overrides . See for an option format description. @@ -118,7 +118,9 @@ in setOptions = mkOption { type = types.listOf types.str; default = [ - "HIST_IGNORE_DUPS" "SHARE_HISTORY" "HIST_FCNTL_LOCK" + "HIST_IGNORE_DUPS" + "SHARE_HISTORY" + "HIST_FCNTL_LOCK" ]; example = [ "EXTENDED_HISTORY" "RM_STAR_WAIT" ]; description = '' @@ -279,14 +281,18 @@ 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; + ++ optional + (cfg.enableCompletion + && !lib.versionAtLeast (lib.getVersion config.nix.package) "2.4pre") + pkgs.nix-zsh-completions; environment.pathsToLink = optional cfg.enableCompletion "/share/zsh"; #users.defaultUserShell = mkDefault "/run/current-system/sw/bin/zsh"; environment.shells = - [ "/run/current-system/sw/bin/zsh" + [ + "/run/current-system/sw/bin/zsh" "${pkgs.zsh}/bin/zsh" ]; From 6dbf8c04097c8961bb1cb9cb319fee42eb19ab7a Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Sat, 3 Jul 2021 13:54:00 -0600 Subject: [PATCH 3/3] zsh: include completions for nix-* commands --- nixos/modules/programs/zsh/zsh.nix | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/nixos/modules/programs/zsh/zsh.nix b/nixos/modules/programs/zsh/zsh.nix index 4eac7c8afbf6..e0335643b6e3 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";