From 4d59f660bc41ba35b1f6df829e8e0b7706b35ee7 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Tue, 10 Sep 2024 21:35:35 +0200 Subject: [PATCH 1/2] zsh: move fpath init from /etc/zshrc to /etc/zshenv We want these to be set even when /etc/zshrc loading is disabled. NixOS/nixpkgs@f70e3f3738300ef1e94737c09364cd176893858f --- modules/programs/zsh/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index bbf8ad9e0..15d5ba7c3 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -135,6 +135,11 @@ in . ${config.system.build.setEnvironment} fi + # Tell zsh how to find installed completions + for p in ''${(z)NIX_PROFILES}; do + fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions) + done + ${cfg.shellInit} # Read system-wide modifications. @@ -182,11 +187,6 @@ in ${config.environment.interactiveShellInit} ${cfg.interactiveShellInit} - # Tell zsh how to find installed completions - for p in ''${(z)NIX_PROFILES}; do - fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions) - done - ${cfg.promptInit} ${optionalString cfg.enableGlobalCompInit "autoload -U compinit && compinit"} From 15f64efcaf936f3b77955018d29b4802be6b144f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Reu=C3=9Fe?= Date: Tue, 10 Sep 2024 21:40:11 +0200 Subject: [PATCH 2/2] zsh: prefer Nix completions these from Zsh package Zsh ships some rudimentary completions for programs where upstream also ships their own completions (e.g., curl). So as not to shadow those completions, we need to prepend to the fpath instead of appending. NixOS/nixpkgs@8dad5a22399782a4ef681174219546cb050e580f --- modules/programs/zsh/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/zsh/default.nix b/modules/programs/zsh/default.nix index 15d5ba7c3..58a3155fc 100644 --- a/modules/programs/zsh/default.nix +++ b/modules/programs/zsh/default.nix @@ -137,7 +137,7 @@ in # Tell zsh how to find installed completions for p in ''${(z)NIX_PROFILES}; do - fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions) + fpath=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions $p/share/zsh/vendor-completions $fpath) done ${cfg.shellInit}