refactor: simplify homebrew shellenv init without brittle caching

This commit is contained in:
2026-01-02 18:39:53 -06:00
parent 2cf33f7a24
commit 00e0c7188b
2 changed files with 4 additions and 26 deletions
@@ -45,20 +45,9 @@ else if test -f $HOME/.cargo/env
set -a paths_to_add $CARGO_HOME/bin
end
# Homebrew (cached for performance - reduces startup time by ~14ms)
# Homebrew
if test -f /home/linuxbrew/.linuxbrew/bin/brew
set -l brew_cache "$HOME/.cache/brew_env.fish"
set -l brew_bin "/home/linuxbrew/.linuxbrew/bin/brew"
# Regenerate cache if: doesn't exist, >7 days old, or brew binary is newer
if not test -f "$brew_cache"; \
or test (math (date +%s) - (stat -c %Y "$brew_cache" 2>/dev/null || echo 0)) -gt 604800; \
or test (stat -c %Y "$brew_bin" 2>/dev/null || echo 0) -gt (stat -c %Y "$brew_cache" 2>/dev/null || echo 0)
mkdir -p (dirname "$brew_cache")
$brew_bin shellenv > "$brew_cache" 2>/dev/null
end
test -f "$brew_cache" && source "$brew_cache"
/home/linuxbrew/.linuxbrew/bin/brew shellenv fish | source
end
set -gx PYENV_ROOT $HOME/.pyenv