refactor(nix): improve zsh compinit handling
Some checks failed
Check Formatting of Files / Check-Formatting (push) Has been cancelled

This commit is contained in:
Price Hiller 2024-05-28 18:48:59 -05:00
parent cfecd96017
commit 2f9e7a94f6
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB
5 changed files with 33 additions and 11 deletions

View File

@ -2,7 +2,10 @@
{
programs = {
dconf.enable = true;
zsh.enable = true;
zsh = {
enable = true;
enableGlobalCompInit = false;
};
nix-ld.enable = true;
};
}

View File

@ -2,9 +2,7 @@
{
programs.password-store = {
enable = true;
package = pkgs.pass.withExtensions(exts: [
exts.pass-file
]);
package = pkgs.pass.withExtensions (exts: [ exts.pass-file ]);
settings = {
PASSWORD_STORE_KEY = "C3FADDE7A8534BEB";
};

View File

@ -0,0 +1,23 @@
{ ... }:
{
programs.zsh = {
enable = true;
enableCompletion = true;
completionInit = ''
() {
autoload -U compinit
local zsh_cache="''${XDG_CACHE_HOME:-$HOME}/zsh/"
if [[ ! -d "$zsh_cache" ]]; then
mkdir -p "$zsh_cache"
fi
local _comp_files=($zsh_cache/zcompcache(Nm-20))
if (( $#_comp_files )); then
compinit -i -C -d "$zsh_cache/zcompcache"
else
compinit -i -d "$zsh_cache/zcompcache"
fi
}
'';
initExtra = builtins.readFile ./init-extra.zsh;
};
}

View File

@ -0,0 +1,5 @@
() {
if [[ -n "$XDG_CONFIG_HOME" && -r "$XDG_CONFIG_HOME/zsh/zsh" ]]; then
source "$XDG_CONFIG_HOME/zsh/zsh"
fi
}

View File

@ -261,13 +261,6 @@ in
enable = true;
systemd.enable = true;
};
zsh = {
enable = true;
initExtra = ''
__HM_SESS_VARS_SOURCED= source "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
source "$HOME/.config/zsh/zsh"
'';
};
git = {
enable = true;
userName = "Price Hiller";