From 40787150bd3e3bc5fb7d4811c1da3e133dfca4bf Mon Sep 17 00:00:00 2001 From: Ben Kreeger Date: Tue, 8 Jul 2025 14:05:48 -0500 Subject: [PATCH] Introduce zshenv to the mix as well --- setup.sh | 14 +++++------- zsh/mac-tty.zsh | 4 ---- zsh/mac.zsh | 3 +++ zsh/zprofile | 58 ++++--------------------------------------------- zsh/zshenv | 54 +++++++++++++++++++++++++++++++++++++++++++++ zsh/zshrc | 12 ---------- 6 files changed, 67 insertions(+), 78 deletions(-) delete mode 100644 zsh/mac-tty.zsh create mode 100644 zsh/zshenv diff --git a/setup.sh b/setup.sh index 2e550f3..ab3f75d 100755 --- a/setup.sh +++ b/setup.sh @@ -9,17 +9,15 @@ if [[ ! -d $XDG_CONFIG_HOME ]]; then mkdir -p "$XDG_CONFIG_HOME" fi -if [[ ! -a "$HOME/.zshrc" ]]; then - ln -sfv "$SCRIPTPATH/zsh/zshrc" "$HOME"/.zshrc -fi - -if [[ ! -a "$HOME/.zprofile" ]]; then - ln -sfv "$SCRIPTPATH/zsh/zprofile" "$HOME"/.zprofile -fi - # Symlink directories to $XDG_CONFIG_HOME. directories=("gem" "ghostty" "git" "gnupg" "k9s" "lazygit" "neovide" "nvim" "starship" "tmux" "zed") for directory in "${directories[@]}"; do if [[ -d "$XDG_CONFIG_HOME/$directory" ]]; then continue; fi ln -sfv "$SCRIPTPATH/$directory" "$XDG_CONFIG_HOME/$directory" done + +zshfiles=("zshenv" "zprofile" "zshrc") +for file in "${zshfiles[@]}"; do + if [[ -a "$HOME/.$file" ]]; then continue; fi + ln -sfv "$SCRIPTPATH/zsh/$file" "$HOME/.$file" +done diff --git a/zsh/mac-tty.zsh b/zsh/mac-tty.zsh deleted file mode 100644 index 6140b22..0000000 --- a/zsh/mac-tty.zsh +++ /dev/null @@ -1,4 +0,0 @@ -export GPG_TTY="$(tty)" -export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) -gpgconf --launch gpg-agent - diff --git a/zsh/mac.zsh b/zsh/mac.zsh index bc99715..e39b200 100644 --- a/zsh/mac.zsh +++ b/zsh/mac.zsh @@ -5,3 +5,6 @@ alias rsyncdir="rsync -az --progress" CERT_PATH=$(python -m certifi) export SSL_CERT_FILE=${CERT_PATH} export REQUESTS_CA_BUNDLE=${CERT_PATH} +export GPG_TTY="$(tty)" +export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) +gpgconf --launch gpg-agent diff --git a/zsh/zprofile b/zsh/zprofile index 0eeda8e..05ed58b 100644 --- a/zsh/zprofile +++ b/zsh/zprofile @@ -1,70 +1,20 @@ # vim: filetype=zsh SCRIPTPATH=$HOME/.config/dotfiles/zsh +ZSH_CACHE_DIR="$HOME/.cache/zsh" # google cloud sdk if [[ -a "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc" ]]; then source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc" fi - -# rust additions -if [[ -a "$HOME/.cargo/bin" ]]; then - export PATH="$HOME/.cargo/bin:$PATH" -fi - -# krew additions -if [[ -a "$HOME/.krew" ]]; then - export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" -fi - -# pythonpath additions -if [[ -a "$HOME/src/oreilly/tools/chassis" ]]; then - export PYTHONPATH="${PYTHONPATH}:$HOME/src/oreilly/tools/chassis" -fi - -# Android SDK additions -if [[ -a "$HOME/Library/Android/sdk/platform-tools" ]]; then - export PATH="$HOME/Library/Android/sdk/platform-tools:$PATH" -fi - -if [[ -a "$HOME/Library/Android/sdk/emulator" ]]; then - export PATH="$HOME/Library/Android/sdk/emulator:$PATH" -fi - -# Local bin additions -if [[ -d "$HOME/bin" ]]; then - export PATH="$HOME/bin:$PATH" -fi - # homebrew if [[ -a "/opt/homebrew/bin/brew" ]]; then eval "$(/opt/homebrew/bin/brew shellenv)" fi -# asdf -if [[ -d "$HOME/.asdf/shims" ]]; then - export PATH="$HOME/.asdf/shims:$PATH" -fi - -# env -export EDITOR=nvim -export GOPATH=~/src/golang -export GOBIN=$GOPATH/bin -export PATH=~/bin:$GOBIN:$PATH -export XDG_CONFIG_HOME=$HOME/.config -export TALOSCONFIG=$XDG_CONFIG_HOME/talos/config.yaml -export GNUPGHOME=$XDG_CONFIG_HOME/gnupg -kubeconfig=( - $XDG_CONFIG_HOME/kube/k8s-dev.yaml - $XDG_CONFIG_HOME/kube/k8s.yaml - $XDG_CONFIG_HOME/kube/k8s-old.yaml - $XDG_CONFIG_HOME/kube/gke.yaml -) -export KUBECONFIG=${(j.:.)kubeconfig} - -if [[ -d "/opt/homebrew/share/google-cloud-sdk/bin" ]]; then - export PATH=/opt/homebrew/share/google-cloud-sdk/bin:$PATH -fi +# plugins +mkdir -p "$ZSH_CACHE_DIR" +source "$SCRIPTPATH/dotenv.zsh" # other files source "$SCRIPTPATH/functions.zsh" diff --git a/zsh/zshenv b/zsh/zshenv new file mode 100644 index 0000000..b752f73 --- /dev/null +++ b/zsh/zshenv @@ -0,0 +1,54 @@ +# vim: filetype=zsh + +# env +export EDITOR=nvim +export GOPATH=~/src/golang +export GOBIN=$GOPATH/bin +export PATH=~/bin:$GOBIN:$PATH +export XDG_CONFIG_HOME=$HOME/.config +export TALOSCONFIG=$XDG_CONFIG_HOME/talos/config.yaml +export GNUPGHOME=$XDG_CONFIG_HOME/gnupg +kubeconfig=( + $XDG_CONFIG_HOME/kube/k8s-dev.yaml + $XDG_CONFIG_HOME/kube/k8s.yaml + $XDG_CONFIG_HOME/kube/k8s-old.yaml + $XDG_CONFIG_HOME/kube/gke.yaml +) +export KUBECONFIG=${(j.:.)kubeconfig} + +# rust additions +if [[ -a "$HOME/.cargo/bin" ]]; then + export PATH="$HOME/.cargo/bin:$PATH" +fi + +# krew additions +if [[ -a "$HOME/.krew" ]]; then + export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" +fi + +# pythonpath additions +if [[ -a "$HOME/src/oreilly/tools/chassis" ]]; then + export PYTHONPATH="${PYTHONPATH}:$HOME/src/oreilly/tools/chassis" +fi + +# Android SDK additions +if [[ -a "$HOME/Library/Android/sdk/platform-tools" ]]; then + export PATH="$HOME/Library/Android/sdk/platform-tools:$PATH" +fi + +if [[ -a "$HOME/Library/Android/sdk/emulator" ]]; then + export PATH="$HOME/Library/Android/sdk/emulator:$PATH" +fi + +# Local bin additions +if [[ -d "$HOME/bin" ]]; then + export PATH="$HOME/bin:$PATH" +fi + +# asdf +if [[ -d "$HOME/.asdf/shims" ]]; then + export PATH="$HOME/.asdf/shims:$PATH" +fi +if [[ -d "/opt/homebrew/share/google-cloud-sdk/bin" ]]; then + export PATH=/opt/homebrew/share/google-cloud-sdk/bin:$PATH +fi diff --git a/zsh/zshrc b/zsh/zshrc index fa55786..9585059 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -5,7 +5,6 @@ colors # Make sure moving by whole word can stop at directories WORDCHARS='*?_-.[]~=&;!#$%^(){}<>' -ZSH_CACHE_DIR="$HOME/.cache/zsh" # history support, time reporting, auto-cd HISTFILE=~/.zhistory @@ -47,14 +46,3 @@ fi if [[ -d "$HOME/.asdf/completions" ]]; then fpath=($HOME/.asdf/completions $fpath) fi - -# plugins -mkdir -p "$ZSH_CACHE_DIR" -source "$SCRIPTPATH/dotenv.zsh" - -# What OS are we running? -if [[ $(uname) == "Darwin" ]]; then - source $SCRIPTPATH/mac-tty.zsh -fi - -# See zprofile for all other exports and path configuration