-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_install.sh
More file actions
executable file
·224 lines (188 loc) · 5.43 KB
/
_install.sh
File metadata and controls
executable file
·224 lines (188 loc) · 5.43 KB
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#!/bin/bash
LINUX_INSTALL_X_WINDOWS=1
LINUX_INSTALL_CORE_APPLICATIONS=1
LINUX_INSTALL_GRAPHICAL_APPLICATIONS=1
LINUX_INSTALL_NVIDIA_DRIVERS=1
OS_NAME=$(uname -s)
# figlet -f rozzo "macos"
MESSAGE_MACOS=$(cat <<'EOM'
888 888 8e ,"Y88b e88'888 e88 88e dP"Y
888 888 88b "8" 888 d888 '8 d888 888b C88b
888 888 888 ,ee 888 Y888 , Y888 888P Y88D
888 888 888 "88 888 "88,e8' "88 88" d,dP
EOM
)
# figlet -f rozzo "linux"
MESSAGE_LINUX=$(cat <<'EOM'
888 ,e,
888 x 888 8e 8888 8888 Y8b Y8Y
888 888 888 88b 8888 8888 Y8b Y
888 888 888 888 Y888 888P e Y8b
888 888 888 888 "88 88" d8b Y8b
EOM
)
###############################################################################
# Helpers #
###############################################################################
# Log a message with a timestamp
# Arguments:
# Message
function _log() {
message="$1"
echo "$(date +"%T") - ${message}"
}
if [ ! -d ~/.tmux/plugins/tpm ]; then
_log "Installing Tmux Plugin Manager"
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
###############################################################################
# MacOS #
###############################################################################
if [ "$OS_NAME" = 'Darwin' ]; then
# echo "$_message_macos"
# Install Homewbrew
if command -v brew >/dev/null; then
_log "Homebrew is already installed"
else
_log "Installing Homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
fi
# Install core packages and casks (NOTE: one can find a list of top-level packages with `brew
# leaves`)
_log "Installing brew packages"
brew install \
bash \
bash-completion \
bat \
chatblade \
cmake \
curl \
direnv \
duckdb \
eza \
fd \
ffmpeg \
figlet \
fzf \
gh \
git \
httpie \
imagemagick \
jq \
llm \
neovim \
nvm \
openssh \
pass \
pass-otp \
pdfgrep \
pinentry-mac \
pnpm \
pre-commit \
pyenv \
pyenv-virtualenv \
ranger \
ripgrep \
sad \
shfmt \
stow \
stylua \
the_silver_searcher \
tldr \
tmux \
uv \
watch \
withgraphite/tap/graphite \
yarn \
&>/dev/null
_log "Installing brew casks"
brew install --cask \
firefox \
ghostty \
hammerspoon \
mpv \
notion \
notion-calendar \
slack \
&>/dev/null
# spotify \
# docker \
# linear-linear \
# snowflake-snowsql \
# zoom
_log "Installing LTS version of Node.js"
if [ -s "/opt/homebrew/opt/nvm/nvm.sh" ]; then
# shellcheck source=/dev/null
source "/opt/homebrew/opt/nvm/nvm.sh"
nvm install --lts
fi
if [ ! -d ~/.hammerspoon/Spoons/SpoonInstall.spoon ]; then
_log 'Installing Hammerspoon SpoonInstall.spoon'
curl -O -L https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SpoonInstall.spoon.zip
unzip SpoonInstall.spoon.zip
open SpoonInstall.spoon
fi
_log 'NOTE: If Chromium.app fails to open, run: xattr -cr /Applications/Chromium.app'
fi
if [ "$OS_NAME" = 'Linux' ]; then
echo "$_message_linux"
if [[ $EUID -ne 0 ]]; then
_log "This script must be run as root. Run \`sudo ./_install.sh\`."
exit 1
fi
# Install core packages with `pacman` (NOTE: one can find a list of installed packages using `pacman -Qe`)
if command -v pacman >/dev/null; then
_log "Upgrading system packages."
pacman -Syu --noconfirm >/dev/null
if [ "$LINUX_INSTALL_CORE_APPLICATIONS" -eq 1 ]; then
_log "Installing core packages."
pacman -S --needed --noconfirm \
bash-completion \
bat \
eza \
fd \
fzf \
git \
jq \
neovim \
openssh \
pass \
pass-otp \
ripgrep \
sensors-detect \
stow \
sudo \
tldr \
tmux \
unzip \
zip \
2>/dev/null
fi
if [ "$LINUX_INSTALL_NVIDIA_DRIVERS" -eq 1 ]; then
_log "Installing \`nvidia\` drivers."
# lspci -k -d ::03xx
pacman -S --needed --noconfirm \
nvidia \
>/dev/null 2>&1
fi
if [ "$LINUX_INSTALL_X_WINDOWS" -eq 1 ]; then
_log "Installing X windows."
pacman -S --needed --noconfirm \
i3-wm \
i3status \
rofi \
xclip \
xorg-server \
xorg-xinit \
xorg-xset \
>/dev/null 2>&1
fi
if [ "$LINUX_INSTALL_GRAPHICAL_APPLICATIONS" -eq 1 ]; then
_log "Installing GUI applications."
pacman -S --needed --noconfirm \
ghostty \
firefox \
>/dev/null 2>&1
fi
fi
fi