diff --git a/setup.sh b/setup.sh index c5561d3..d259db8 100755 --- a/setup.sh +++ b/setup.sh @@ -13,6 +13,10 @@ 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" "nvim" "starship" "tmux" "zed") for directory in "${directories[@]}"; do diff --git a/zsh/mac-tty.zsh b/zsh/mac-tty.zsh new file mode 100644 index 0000000..6140b22 --- /dev/null +++ b/zsh/mac-tty.zsh @@ -0,0 +1,4 @@ +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 080508f..bc99715 100644 --- a/zsh/mac.zsh +++ b/zsh/mac.zsh @@ -5,7 +5,3 @@ 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 new file mode 100644 index 0000000..2262c3d --- /dev/null +++ b/zsh/zprofile @@ -0,0 +1,87 @@ +SCRIPTPATH=$HOME/.config/dotfiles/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 + +if [[ -a "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc" ]]; then + source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.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 + +# other files +source "$SCRIPTPATH/functions.zsh" +source "$SCRIPTPATH/aliases.zsh" + +# private aliases +if [[ -a "$SCRIPTPATH/private.zsh" ]]; then + source $SCRIPTPATH/private.zsh +fi + +# What OS are we running? +if [[ $(uname) == "Darwin" ]]; then + source $SCRIPTPATH/mac.zsh +else + # Assume *nix of some kind + source $SCRIPTPATH/linux.zsh +fi + diff --git a/zsh/zshrc b/zsh/zshrc index b72ce53..255a810 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -32,49 +32,6 @@ if [[ -a "$SCRIPTPATH/zsh-completions/zsh-completions.plugin.zsh" ]]; then fpath=($SCRIPTPATH/zsh-completions/src $fpath) fi -# 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 - -if [[ -a "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc" ]]; then - source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.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 - # starship if [[ -x "$(command -v starship)" ]]; then export STARSHIP_CONFIG="$HOME/.config/starship/starship.toml" @@ -82,9 +39,6 @@ if [[ -x "$(command -v starship)" ]]; then fi # asdf -if [[ -d "$HOME/.asdf/shims" ]]; then - export PATH="$HOME/.asdf/shims:$PATH" -fi if [[ -d "$HOME/.asdf/completions" ]]; then fpath=($HOME/.asdf/completions $fpath) fi @@ -93,38 +47,9 @@ fi mkdir -p "$ZSH_CACHE_DIR" source "$SCRIPTPATH/dotenv.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/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 - -# other files -source "$SCRIPTPATH/functions.zsh" -source "$SCRIPTPATH/aliases.zsh" - -# private aliases -if [[ -a "$SCRIPTPATH/private.zsh" ]]; then - source $SCRIPTPATH/private.zsh -fi - # What OS are we running? if [[ $(uname) == "Darwin" ]]; then - source $SCRIPTPATH/mac.zsh -else - # Assume *nix of some kind - source $SCRIPTPATH/linux.zsh + source $SCRIPTPATH/mac-tty.zsh fi + +# See zprofile for all other exports and path configuration