-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbash_profile
165 lines (134 loc) · 4.41 KB
/
bash_profile
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
# .bash_profile - login shells (called one time)
# TODO: mklink - "git bash shell fails to create symbolic links"
# If not running interactively, don't do anything
#[ -z "$PS1" ] && return
[[ "$-" != *i* ]] && return
# Determine OS type
uname_str="$(uname -s)"
case "${uname_str}" in
Linux*) sysos=linux;;
Darwin*) sysos=macos;;
CYGWIN*) sysos=cygwin;;
MINGW*) sysos=mingw;;
*) sysos="UNKNOWN:${uname_str}"
esac
export SYSOS=$sysos
# Prevent PATH from being sorted when using tmux on macos (via /usr/libexec/path_helper)
# See: https://superuser.com/questions/544989/does-tmux-sort-the-path-variable
# - Sorting the path causes issues with switching between git and Xcode-git
# and with macport's python (3) version selector method
# - May want to look at double sourcing on macos
if [ "$SYSOS" == "macos" ] && [ -n "$TMUX" ] && [ -f /etc/profile ]; then
PATH=""
source /etc/profile
fi
# linux
# let &t_EI .= "\<Esc>[2 q"
#
if [ "$BASH_PROFILE_WAS_RUN" == "1" ]; then
echo ".bash_profile was run twice"
fi
BASH_PROFILE_WAS_RUN=1
pathmunge () {
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ -e $1 ] ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
esac
}
# Add a few directories to PATH
pathmunge $HOME/bin after
pathmunge $HOME/usr/bin after
pathmunge /opt/bin
# Haskell additions
pathmunge $HOME/.ghcup/bin
pathmunge $HOME/.cabal/bin
# Rust additions
pathmunge $HOME/.cargo/bin
pathmunge /Applications/CoqIDE_8.4pl5.app/Contents/Resources/bin after
pathmunge /Users/kippesp/.emacs.d/lisp/PG/coq after
pathmunge /opt/verilator-3.902/bin after
# MacPorts additions
pathmunge /opt/local/libexec/gnubin
pathmunge /opt/local/bin
pathmunge /opt/local/sbin
pathmunge /opt/local/Library/Frameworks/Python.framework/Versions/Current/bin
# Local (macos) Python installations
pathmunge $HOME/Library/Python/Current/bin
pathmunge $HOME/.local/bin
# MacOS git
# pathmunge /usr/local/git/bin
# Local LLVM
# pathmunge /opt/clang+llvm-7.0.0-x86_64-apple-darwin/bin after
# pathmunge /opt/clang+llvm-6.0.0-x86_64-apple-darwin/bin after
# pathmunge /opt/clang+llvm-5.0.0-x86_64-apple-darwin/bin after
pathmunge $HOME/usr/opt/llvm-latest/bin
# Local cmake
# pathmunge $HOME/usr/opt/cmake-3.18.1/bin
pathmunge $HOME/usr/opt/cmake/current/bin
pathmunge /opt/cmake/cmake-current/bin
# Pickup libc++api in my local LLVM
#if [ -d $HOME/usr/opt/llvm-latest/lib ]; then
# if [ "$LD_LIBRARY_PATH" != "" ]; then
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/usr/opt/llvm-latest/lib
# else
# export LD_LIBRARY_PATH=$HOME/usr/opt/llvm-latest/lib
# fi
#fi
# Anaconda/miniconda/pipenv packages
# Place at end to prevent clash with python3-pkginfo's pkginfo (ubuntu)
# Continue to use "source activate ENV_NAME"
# pathmunge $HOME/miniconda3/bin after
# Verilator
pathmunge /opt/verilator/bin after
# Yarn-installed binaries (such as brili)
pathmunge $HOME/.yarn/bin after
# Various retro stuff
pathmunge $HOME/opt/apple_ii/CiderPress2/cp2/bin after
pathmunge $HOME/opt/apple_ii/Maconv/bin after
export PATH
# TODO - ??macos only?? Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# Enable bash-completion from macports
if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
. /opt/local/etc/profile.d/bash_completion.sh
fi
# Enable fzf's fuzzy auto completion for bash (from macports)
_=`fzf --version > /dev/null 2>&1`
if [ $? -eq 0 ]; then
if [ -f /opt/local/share/fzf/shell/key-bindings.bash ]; then
. /opt/local/share/fzf/shell/key-bindings.bash
fi
fi
# Enable nvm from macports
if [ -f /opt/local/share/nvm/init-nvm.sh ]; then
. /opt/local/share/nvm/init-nvm.sh
fi
if [ -e ~/.bash_profile.local ] ; then
. ~/.bash_profile.local
fi
# Linux: Hook in a project script for each tmux window when starting tmux with
# a script like the following
# (source: https://stackoverflow.com/questions/20701757/tmux-setting-environment-variables-for-sessions)
# Macos: Doesn't have this issue
#!/bin/sh
# BAR=/path/to/project/script/file.sh
# SESSION_NAME="mysession"
# tmux new-session -s $SESSION_NAME \; \
# setenv TMUX_SESSION_HOOK $BAR \; \
# send-keys -t 0 "export TMUX_SESSION_HOOK="$BAR C-m \; \
# send-keys -t 0 '. $TMUX_SESSION_HOOK' C-m \;
if [ "$TMUX_SESSION_HOOK" != "" ]; then
. $TMUX_SESSION_HOOK
fi
# Cleanup
unset -f pathmunge