flake-update-20260505
 1# Direnv — cached hook to avoid fork on every startup
 2has direnv || return
 3
 4local cache=${XDG_CACHE_HOME:-$HOME/.cache}/zsh/direnv-init.zsh
 5local bin=$(realpath ${commands[direnv]})
 6
 7# Regenerate if cache is missing, binary is newer, or the resolved
 8# path changed (e.g. nix store path updated without timestamp change)
 9if [[ ! -f $cache || $bin -nt $cache ]] || ! grep -qF "$bin" "$cache" 2>/dev/null; then
10  mkdir -p ${cache:h}
11  direnv hook zsh > "$cache"
12  _zsh_compile_if_needed "$cache"
13fi
14source "$cache"