adopt for homebrew path

This commit is contained in:
Matthias Kretschmann 2023-01-23 18:05:14 +00:00
parent ff400f72ec
commit 9b24b09040
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 50 additions and 28 deletions

View File

@ -54,9 +54,9 @@ echo " ✓ done$(tput sgr0)"
# ----------------------------------------------------------------------
# Switch to using brew-installed zsh as default shell
if ! grep -F -q '/usr/local/bin/zsh' /etc/shells; then
echo '/usr/local/bin/zsh' | sudo tee -a /etc/shells;
chsh -s /usr/local/bin/zsh;
if ! grep -F -q '/opt/homebrew/bin/zsh' /etc/shells; then
echo '/opt/homebrew/bin/zsh' | sudo tee -a /etc/shells;
chsh -s /opt/homebrew/bin/zsh;
fi;
echo "$(tput setaf 64)============================================="

45
exports
View File

@ -8,35 +8,50 @@ export LANG="en_US"
# PATH
# ---------------------------------------------------
PATH_OPENSSL=/usr/local/opt/openssl/bin
# Homebrew path differs between Intel/Apple Silicon
# See https://apple.stackexchange.com/questions/437618/why-is-homebrew-installed-in-opt-homebrew-on-apple-silicon-macs
# Hardcoded paths because `brew --prefix ...` is slow
if [[ $(uname -m) == 'arm64' ]]; then
PATH_HOMEBREW=/opt/homebrew
else
PATH_HOMEBREW=/usr/local
fi
PATH_OPENSSL=$PATH_HOMEBREW/opt/openssl/bin
# PATH_RUBY=$(brew --prefix ruby)/bin
# PATH_GEMS=/usr/local/lib/ruby/gems/2.6.0/bin
PATH_PYTHON=/usr/local/opt/python/libexec/bin
PATH_GO=/usr/local/opt/go/libexec/bin
# PATH_GEMS=$PATH_HOMEBREW/lib/ruby/gems/2.6.0/bin
PATH_PYTHON=$PATH_HOMEBREW/opt/python/libexec/bin
PATH_GO=$PATH_HOMEBREW/opt/go/libexec/bin
#PATH_RUST=$HOME/.cargo/bin
export GOPATH=$HOME/.go/
export PATH=$HOME/.bin:/usr/local/bin:$PATH_OPENSSL:$PATH_PYTHON:$GOPATH/bin:$PATH_GO:$PATH
export PATH=$HOME/.bin:/$PATH_HOMEBREW/bin:$PATH_OPENSSL:$PATH_PYTHON:$GOPATH/bin:$PATH_GO:$PATH
# define CDPATHs which are autocompleted from when doing cd
export CDPATH=$CDPATH:~/Code
# nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# defer loading until needed for faster shell startup
declare -a NODE_GLOBALS=(`find ~/.nvm/versions/node -maxdepth 3 -type l -wholename '*/bin/*' | xargs -n1 basename | sort | uniq`)
#declare -a NODE_GLOBALS=(`find ~/.nvm/versions/node -maxdepth 3 -type l -wholename '*/bin/*' | xargs -n1 basename | sort | uniq`)
NODE_GLOBALS+=("node")
NODE_GLOBALS+=("nvm")
#NODE_GLOBALS+=("node")
#NODE_GLOBALS+=("nvm")
load_nvm () {
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
}
#load_nvm () {
# export NVM_DIR="$HOME/.nvm"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
#}
for cmd in "${NODE_GLOBALS[@]}"; do
eval "${cmd}(){ unset -f ${NODE_GLOBALS}; load_nvm; ${cmd} \$@ }"
done
#for cmd in "${NODE_GLOBALS[@]}"; do
# eval "${cmd}(){ unset -f ${NODE_GLOBALS}; load_nvm; ${cmd} \$@ }"
#done
# pip should only run if there is a virtualenv currently activated
export PIP_REQUIRE_VIRTUALENV=true
# cache pip-installed packages to avoid re-downloading
export PIP_DOWNLOAD_CACHE=$HOME/.pip/cache
export GPG_TTY=$(tty)

View File

@ -10,7 +10,7 @@
[user]
name = Matthias Kretschmann
email = m@kretschmann.io
signingKey = DD7831FC
signingKey = BD3C1F3EDD7831FC
[commit]
gpgSign = true
@ -60,6 +60,12 @@
[fetch]
prune = true
[pull]
rebase = false
[init]
defaultBranch = main
[status]
showUntrackedFiles = all
@ -89,9 +95,4 @@
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
[pull]
rebase = false
[gpg]
program = /usr/local/bin/gpg
[init]
defaultBranch = main

12
zshrc
View File

@ -80,8 +80,14 @@ if [[ $#h -gt 0 ]]; then
zstyle ':completion:*:(ssh|scp|rsync|slogin):*' hosts $h
fi
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
if [[ $(uname -m) == 'arm64' ]]; then
PATH_HOMEBREW=/opt/homebrew
else
PATH_HOMEBREW=/usr/local
fi
source $PATH_HOMEBREW/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $PATH_HOMEBREW/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# source <(kubectl completion zsh)
#
@ -93,4 +99,4 @@ source ~/.exports
source ~/.aliases
source ~/.private
# zprof
# zprof