-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_once_setup.sh.tmpl
304 lines (266 loc) · 7.79 KB
/
run_once_setup.sh.tmpl
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
{{- if eq .chezmoi.os "linux" -}}
#!/usr/bin/env bash
set -euo pipefail
###############################################################################
# Step 1: Install Paru (AUR helper)
###############################################################################
sudo pacman -Sy
if ! command -v paru &> /dev/null; then
dir_path="/tmp/$(date +%s)-paru"
git clone https://aur.archlinux.org/paru.git "${dir_path}"
cd "${dir_path}" && makepkg -si; cd - && rm -rf "${dir_path}"
fi
###############################################################################
# Step 2: Install packages
###############################################################################
paru --needed -S \
alacritty \
ansible \
alsa-utils \
base-devel \
bash-completion \
bumblebee-status \
chezmoi \
dkms \
dmenu \
dnsutils \
eslint \
exfatprogs \
feh \
firefox \
flake8 \
glances \
hadolint-bin \
i3-gaps \
i3lock-color \
inetutils \
jq \
kwallet-pam \
linux-headers \
lua \
luacheck \
usbutils \
make \
man \
mpack \
neofetch \
neovim \
nerd-fonts-hack \
nmap \
nvme-cli \
openssh \
pam_autologin \
picom \
python-beautifulsoup4 \
python-coloredlogs \
python-flake8-docstrings \
python-neovim \
python-pdm \
python-pip \
python-pipenv \
python-pycodestyle \
python-pydocstyle \
python-pylint \
python-pylint-flask \
python-pyx \
rsync \
ruby-sqlint \
rustup \
shellcheck \
sg3_utils \
smartmontools \
standard \
tmux \
tree \
twine \
unclutter-xfixes-git \
vagrant \
ventoy-bin \
virtualbox \
xclip \
xf86-video-intel \
xorg-server \
xorg-xinit \
xorg-xprop \
yarn \
wget \
zfs-dkms
{{ if eq .host.chassis_type "vm" }}
if ! command -v vmware-user-suid-wrapper &> /dev/null; then
sudo pacman -S \
gtkmm3 \
mesa \
open-vm-tools \
xf86-input-vmmouse \
xf86-video-vmware
sudo systemctl enable vmtoolsd.service
sudo systemctl enable vmware-vmblock-fuse.service
echo '---(!) WARNING: Add the following modules to /etc/mkinitcpio.conf and'
echo '---(!) WARNING: run "mkinitcpio -p linux" to regenerate initramfs'
echo 'vsock vmw_vsock_vmci_transport vmw_balloon vmw_pvscsi vmw_vmci vmwgfx vmxnet3'
fi
{{ end }}
###############################################################################
# Step 3: Create directories
###############################################################################
{{ if ne .host.desktop_environment "kde" }}
mkdir -p ~/casino
mkdir -p ~/development
mkdir -p ~/documents/notes
mkdir -p ~/pictures/screenshots
{{ if eq .host.chassis_type "laptop" }}
mkdir -p ~/documents
mkdir -p ~/downloads
mkdir -p ~/music
mkdir -p ~/videos
{{ end }}
{{ if eq .host.chassis_type "vm" }}
mkdir -p ~/scratch
{{ end }}
{{ end }}
{{- else if eq .chezmoi.os "darwin" -}}
#!/usr/bin/env zsh
set -euo pipefail
###############################################################################
# Step 1: Change system-wide defaults
###############################################################################
# Disable annoying press and hold
defaults write -g ApplePressAndHoldEnabled -bool false
# Show dock on all displays
defaults write com.apple.Dock appswitcher-all-displays -bool true
killall Dock
###############################################################################
# Step 2: Install packages
###############################################################################
/opt/homebrew/bin/brew install \
ansible \
ansible-lint \
asciinema \
bash \
bash-completion@2 \
buildifier \
coreutils \
exiftool \
findutils \
gawk \
gh \
glances \
gnu-getopt \
gnu-indent \
gnu-sed \
gnu-tar \
gnutls \
hadolint \
iconsur \
ipmitool \
iproute2mac \
jq \
megacmd \
megatools \
minicom \
mtr \
neovim \
nmap \
nodejs \
openscad \
pdm \
pipx \
poetry \
python \
pipenv \
ruby \
rustup \
screen \
shellcheck \
smartmontools \
tmate \
tmux \
tree \
typescript \
watch \
zstd \
yarn
# NOTE: Should probably be installed manually when needed
# openzfs \
# Install pipx packages
/opt/homebrew/bin/pipx install \
osxphotos
# Initialise Rust
/opt/homebrew/bin/rustup-init
# NOTE: Deprecated as of 2024-06-15
#/opt/homebrew/bin/brew tap homebrew/cask-fonts
/opt/homebrew/bin/brew install --cask font-hack-nerd-font
xcode-select --install || :
xcodebuild -license accept || :
# FIXME: This is broken, presumably because Ruby version is too old
# echo '---(i) INFO: Install neovim Ruby gem -- password prompt inbound'
# sudo gem install neovim
PATH="${PATH}:/opt/homebrew/bin" /opt/homebrew/bin/npm install -g nativefier neovim
# NOTE: Broken as of 2024-06-15, complains about "externally-managed-environment""
#pip3 install --user --upgrade pip pynvim
if test "${SHELL}" != '/opt/homebrew/bin/bash'; then
echo '---(i) INFO: Setting Bash as a default shell'
echo "$(/opt/homebrew/bin/brew --prefix)"/bin/bash | sudo tee -a /private/etc/shells
sudo chpass -s /opt/homebrew/bin/bash "${USER}"
fi
###############################################################################
# Step 3: Create directories
###############################################################################
# NOTE: All other directories should already exist by default
mkdir -p ~/Casino
mkdir -p ~/Development
{{- end }}
###############################################################################
# Step -2: Configure VS Code
###############################################################################
if command -v code; then
echo '---(i) INFO: Installing VS Code extensions'
{{ if eq .chezmoi.os "darwin" }}
"${HOME}/Library/Application Support/Code/User/"install_extensions.sh
{{ else if eq .chezmoi.os "linux" }}
"${HOME}/.config/Code/User/"install_extensions.sh
{{ end }}
{{ if eq .chezmoi.os "darwin" }}
echo '---(i) INFO: Disabling Press & Hold in VS Code to enable key repeat'
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false
{{ end }}
else
echo '---(!) WARN: Skipping extensions setup as VS Code is not installed'
fi
###############################################################################
# Step -1: Execute common commands across Linux / MacOS
###############################################################################
# Install basic Python dependencies
if command -v pip; then
PIP_COMMAND=pip
else
PIP_COMMAND=pip3
fi
readonly PIP_COMMAND
# NOTE: Broken on MacOS as of 2024-06-15, complains about "externally-managed-environment""
{{- if eq .chezmoi.os "linux" -}}
"${PIP_COMMAND}" install \
'pylama[all]' \
uncompyle6 # Byte-code decomp
{{ end }}
# Disable Yarn analytics
PATH="/opt/homebrew/bin:${PATH}" yarn config set --home enableTelemetry 0
# Configure Git
git config --global user.email "{{ .user.email }}"
git config --global user.name "{{ .user.name }}"
# Install and set a default Rust toolchain
rustup install nightly
rustup install stable
rustup default nightly
# Install basic Rust dependencies
cargo install \
cargo-make \
starlark_bin
# Install TPM (Tmux Plugin Manager)
git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm &> /dev/null || :
# Generate missing completion scripts
mkdir -p ~/.bash/completions
/opt/homebrew/bin/pdm completion bash > ~/.bash/completions/pdm.bash-completion
find ~/.cargo/registry/src/ -type d -name 'cargo-make-*' | \
tail -n 1 | \
xargs -I{} cat {}/extra/shell/makers-completion.bash > ~/.bash/completions/cargo_make.bash-completion