zsh: fix compdump cache issue for building zsh completions

This commit is contained in:
Tigor Hutasuhut 2024-07-08 13:54:03 +07:00
parent 95915cb1cf
commit e2861a968a
2 changed files with 10 additions and 5 deletions

View file

@ -1,16 +1,14 @@
{ config, lib, unstable, pkgs, ... }: { config, lib, ... }:
let let
cfg = config.profile.go; cfg = config.profile.go;
in in
{ {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.zsh.initExtra = ''zsh-defer source<(cat ${pkgs.zsh-completions}/share/zsh/site-functions/_golang)'';
programs.go = { programs.go = {
enable = true; enable = true;
goPrivate = [ goPrivate = [
"gitlab.bareksa.com" "gitlab.bareksa.com"
]; ];
package = unstable.go_1_22;
}; };
}; };
} }

View file

@ -11,6 +11,13 @@ in
]; ];
programs.zsh = { programs.zsh = {
enable = true; enable = true;
envExtra = /*bash*/ ''
# Disable loading global RC files in /etc/zsh/*
# Mostly because they are unneeded
# and global rc files has to be small for security reasons (no plugins)
# thus making them saver for Root account to load them.
unsetopt GLOBAL_RCS
'';
autosuggestion.enable = true; autosuggestion.enable = true;
enableCompletion = true; enableCompletion = true;
defaultKeymap = "emacs"; defaultKeymap = "emacs";
@ -47,7 +54,7 @@ in
syntaxHighlighting.enable = true; syntaxHighlighting.enable = true;
initExtraFirst = /*bash*/ '' initExtraFirst = /*bash*/ ''
export ZSH_CACHE_DIR=$HOME/.cache/zsh export ZSH_CACHE_DIR=$HOME/.cache/zsh
mkdir -p $ZSH_CACHE_DIR/completions fpath+=${pkgs.zsh-completions}/share/zsh/site-functions
if [ -f $HOME/.config/zsh/.p10k.zsh ]; then if [ -f $HOME/.config/zsh/.p10k.zsh ]; then
source $HOME/.config/zsh/.p10k.zsh source $HOME/.config/zsh/.p10k.zsh