-
Notifications
You must be signed in to change notification settings - Fork 1
/
.shared.sh
178 lines (153 loc) · 5.63 KB
/
.shared.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
### set max open files, etc
# The "hard limit" (`-H`) could also be set, but only to a value less than the current one, and only to a value not less than the "soft limit" (`-S`).
ulimit -S -n 50000 >&/dev/null || ulimit -S -n 10240 # the first one fails on a non-configured macOS
##
maxproc="$(ulimit -Hu)" # local not allowed on some shells
maxproc=$(( maxproc - 100 )) # give some slack to the OS
if (( maxproc > 500 )) ; then
ulimit -Su "$maxproc"
fi
unset maxproc
###
psource () {
#: @duplicateCode see [[~/.zshenv]] for the original
##
if [[ -r "$1" ]]
then
source "$@"
fi
}
### @duplicateCode/jhsd99wiw3i3hehiajh
if test -z "$NIGHTDIR" ; then
NIGHTDIR=~/scripts # @hardcoded bash/'zsh -f' have no way of determining this by themselves
if ! test -d "$NIGHTDIR" ; then
unset NIGHTDIR
echo "NIGHTDIR not found"
fi
fi
##
export GCM_TRACE=~/tmp/gcm.log
##
# export EMACS_SOCKET_NAME=/tmp/sockets/.emacs
export EMACS_SOCKET_NAME="${EMACS_SOCKET_NAME:-${HOME}/tmp/.emacs-servers/server}"
EMACS_ALT1_SOCKET_NAME="${HOME}/tmp/.emacs-servers/server_alt1"
EMACS_GUI_SOCKET_NAME="${HOME}/tmp/.emacs-servers/server_gui"
###
if true ; then # ! command -v brew &> /dev/null ; then # it's faster to just not check
# Sometimes brew itself is in path but its dirs are not. Also, we want to be able to rerun the code to correct the PATH ordering
if isLinux; then
if test -d ~/.linuxbrew ; then
eval $(~/.linuxbrew/bin/brew shellenv)
fi
if test -d /home/linuxbrew/.linuxbrew ; then
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
typeset -xg brew_bin_dir=/home/linuxbrew/.linuxbrew/bin
addToPATH "$brew_bin_dir" # `brew shellenv` doesn't work on root, it seems
fi
elif isDarwin ; then
if isArm ; then
test -d /opt/homebrew/bin && eval $(/opt/homebrew/bin/brew shellenv)
# see what this code does with:
# `env -i zsh -f -c '/opt/homebrew/bin/brew shellenv'`
if isBash ; then
export brew_bin_dir=/opt/homebrew/bin
else
typeset -xg brew_bin_dir=/opt/homebrew/bin
fi
addToPATH "$brew_bin_dir"
addToPATH /opt/homebrew/sbin
else
typeset -xg brew_bin_dir=/usr/local/bin
fi
fi
fi
if isDarwin ; then
addToPATH /Applications/SuperCollider.app/Contents/Resources
addToPATH /Applications/SuperCollider.app/Contents/MacOS
addToPATH /Applications/MEGAcmd.app/Contents/MacOS
addToPATH ~/'Library/Application Support/Coursier/bin'
fi
if isLinux ; then
addToPATH /usr/local/cuda/bin
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
fi
addToPATH /opt/local/bin /opt/local/sbin # macports
addToPATH /usr/sbin
# addToPATH ~/.emacs.d.doom/bin
addToPATH ~/.emacs.d/bin
addToPATH "$HOME/.dotnet/tools"
addToPATH "/Library/TeX/texbin"
addToPATH "$HOME/.cargo/bin"
isLinux && addToPATH /snap/bin
addToPATH "/sbin"
addToPATH "/usr/local/bin"
addToPATH "/usr/local/sbin"
addToPATH "$HOME/.local/bin"
addToPATH "$HOME/code/resources"
export GOPATH="$HOME/go"
export GOBIN="$GOPATH/bin"
addToPATH "$HOME/go/bin"
addToPATH "/usr/local/opt/texinfo/bin"
addToPATH "$HOME/kscripts"
addToPATH "/usr/libexec"
export GEM_HOME="$HOME/.gem"
addToPATH "$GEM_HOME/bin"
addToPATH "$HOME/.poetry/bin"
addToPATH ~/.nimble/bin
# addToPATH /Applications/mpv.app/Contents/MacOS
addToPATH "${NIGHTDIR}/zshlang/wrappers"
addToPATH "${HOME}/.config/guix/current/bin"
GUIX_PROFILE="${HOME}/.guix-profile"
psource "$GUIX_PROFILE/etc/profile"
# psource ~/anaconda/etc/profile.d/conda.sh
# silence conda deactivate #this is necessary try sbing and you'll see
# silence conda activate base
# PS1="$(echo $PS1 | sed 's/(base) //') "
# PS1="$(strip "$PS1" ' +') "
addToPATH ~/anaconda/bin
addToPATH ~/miniconda3/bin
addToPATH ~/.cargo/bin/
## perl
# [[id:162e013e-ce1b-405a-9d45-e0e223f56d6d][perl/cpanm.org]]
if false; then
##
# can cause a `ListUtil.c: loadable library and perl binaries are mismatched (got handshake key 0xfa80080, needed 0xf880080)` error
##
addToPATH "${HOME}/perl5/bin"
PERL5LIB="${HOME}/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="${HOME}/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"${HOME}/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=${HOME}/perl5"; export PERL_MM_OPT;
else
if isDarwin ; then
# [[id:36836e3f-e409-4867-9ae5-68f16e391efe][perl/cpanm:install path]]
addToPATH /usr/local/Cellar/perl/5.34.0/bin # @hardcoded
fi
fi
##
isDarwin && {
addToPATH /Users/Shared/bin
export MONO_GAC_PREFIX="/usr/local"
export ELM_HOME="/usr/local/bin/"
# Use `brew info openjdk` to link java properly.
# export JAVA_HOME15="$(/usr/libexec/java_home --version 15)"
# export JAVA_HOME=$JAVA_HOME15
export JAVA_HOME="$(/usr/libexec/java_home)"
addToPATH $JAVA_HOME
export ANDROID_SDK_ROOT="$HOME/Library/Android/sdk"
addToPATH /usr/local/opt/qt/bin
export LDFLAGS='-L/usr/local/opt/texinfo/lib -L/usr/local/opt/qt/lib'
export CPPFLAGS="-I/usr/local/opt/qt/include"
# needed by pdf-tools of emacs
export PKG_CONFIG_PATH="/usr/local/opt/qt/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig"
}
export BOOT_CLOJURE_VERSION='1.9.0'
addToPATH "/usr/local/opt/curl/bin"
if test -z "$NIGHTDIR_PATH_MODE" ; then
run-on-each addToPATH "$NIGHTDIR"/**/
fi
addToPATH /myBin/
addToPATH ~/bin # should be last
if isZsh ; then
typeset -Ug path
fi