From d936b477cd9dc01423424f6dcbad4e75217ea3fc Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 17 Jun 2026 14:26:25 -0700 Subject: [PATCH] nixos: use nix store path for zsh lib instead of mutable worktree path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libDir pointed to ${config.dotfiles-worktree}/dotfiles/lib, which gets evaluated at build time — so running `just switch` from inside a worktree would bake that worktree path into /etc/zshenv permanently. If the worktree is later removed, every zsh startup errors with "no matches found". zshLibDir was already defined via builtins.path (a stable nix store copy) but unused. Switch all fpath/autoload/PATH references to it and drop libDir. Co-Authored-By: Claude Sonnet 4.6 --- nixos/environment.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nixos/environment.nix b/nixos/environment.nix index 731c2c71..59b30995 100644 --- a/nixos/environment.nix +++ b/nixos/environment.nix @@ -11,7 +11,6 @@ if envDotfilesWorktree != "" then envDotfilesWorktree else "/srv/dotfiles"; - libDir = "${config.dotfiles-worktree}/dotfiles/lib"; zshLibDir = builtins.path { path = ../dotfiles/lib; name = "dotfiles-zsh-lib"; @@ -77,9 +76,9 @@ in # handled once by oh-my-zsh below, with this check intentionally skipped. ZSH_DISABLE_COMPFIX=true - fpath=("$HOME/.lib/completions" "${libDir}/completions" $fpath) - fpath+="${libDir}/functions" - for file in "${libDir}/functions/"* + fpath=("$HOME/.lib/completions" "${zshLibDir}/completions" $fpath) + fpath+="${zshLibDir}/functions" + for file in "${zshLibDir}/functions/"* do autoload "''${file##*/}" done @@ -184,7 +183,7 @@ in export STARSHIP_INSIDE_EMACS="yes" ''; extraInit = '' - export PATH="$HOME/.cargo/bin:${libDir}/bin:${libDir}/functions:$PATH"; + export PATH="$HOME/.cargo/bin:${zshLibDir}/bin:${zshLibDir}/functions:$PATH"; ''; }; };