From e2861a968aae9d7bbd66e8c3d1628ec586c285ce Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Mon, 8 Jul 2024 13:54:03 +0700 Subject: [PATCH] zsh: fix compdump cache issue for building zsh completions --- home/programs/go.nix | 4 +--- home/programs/zsh.nix | 11 +++++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/home/programs/go.nix b/home/programs/go.nix index 7500b0b..dba450c 100644 --- a/home/programs/go.nix +++ b/home/programs/go.nix @@ -1,16 +1,14 @@ -{ config, lib, unstable, pkgs, ... }: +{ config, lib, ... }: let cfg = config.profile.go; in { config = lib.mkIf cfg.enable { - programs.zsh.initExtra = ''zsh-defer source<(cat ${pkgs.zsh-completions}/share/zsh/site-functions/_golang)''; programs.go = { enable = true; goPrivate = [ "gitlab.bareksa.com" ]; - package = unstable.go_1_22; }; }; } diff --git a/home/programs/zsh.nix b/home/programs/zsh.nix index 3bb0a72..71891ec 100644 --- a/home/programs/zsh.nix +++ b/home/programs/zsh.nix @@ -11,6 +11,13 @@ in ]; programs.zsh = { 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; enableCompletion = true; defaultKeymap = "emacs"; @@ -47,11 +54,11 @@ in syntaxHighlighting.enable = true; initExtraFirst = /*bash*/ '' 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 source $HOME/.config/zsh/.p10k.zsh - fi + fi _ZSH_COLOR_SCHEME_FILE=$HOME/.cache/wallust/sequences if [ -f "$_ZSH_COLOR_SCHEME_FILE" ]; then