-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup
executable file
·373 lines (316 loc) · 11.3 KB
/
setup
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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
#!/bin/sh
# TODO: Install some packages with --asdeps?
# TODO: Install jq
ROOT=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
COMMANDS=( config_alacritty
config_bash
config_emacs
config_firefox
config_git
config_git_go
config_git_rust
config_sway
install_aur
install_packages
install_rust
install_sway
install_tools
install_x
)
# out() { printf "$1 $2\n" "${@:3}"; }
out() { printf "%s %s\n" "$1" "$2"; }
error() { out "==> ERROR:" "$@"; } >&2
die() { error "$@"; exit 1; }
usage() {
out "Usage: $0 <command>..."
out
out "Commands:"
for c in "${COMMANDS[@]}" ; do
out ' ' "$c"
done
}
config_alacritty() {
rm -rf ~/.config/alacritty
mkdir -p ~/.config/alacritty
cp "$ROOT/alacritty/alacritty.yml" ~/.config/alacritty/
}
config_bash() {
# direnv: https://direnv.net/docs/hook.html
cat >>~/.bashrc <<EOF
# BEGIN config_bash
source $ROOT/shell/aliases.sh
export PATH=\$PATH:$HOME/dotFiles/wannabin
export PATH=\$PATH:$HOME/local/bin
export PATH=\$PATH:$HOME/.cargo/bin
export PATH=\$PATH:$HOME/go/bin
eval "\$(fasd --init auto)"
eval "\$(direnv hook bash)"
# END config_bash
EOF
}
config_emacs() {
INIT="$ROOT/emacs/d-init.el"
echo "(load \"$INIT\")" > ~/.emacs
}
config_firefox() {
python firefox.py
}
config_git() {
git config --global init.defaultBranch master
git config --global pull.rebase true
git config --global user.email "[email protected]"
git config --global user.name "Yordan Miladinov"
}
config_git_go() {
git config --global [email protected]:.insteadOf https://github.com/
}
config_git_rust() {
git config --global --remove-section "[email protected]:"
}
config_sway() {
SWAY="$HOME/.config/sway"
# Make a backup
if [ -d "$SWAY" ] ; then
BACKUP=$HOME/.config/sway.backup
rm -rf "$BACKUP"
cp -r "$SWAY" "$BACKUP"
fi
# Make sure ~/.config/sway exists.
mkdir -p "$SWAY"
# Copy example config.
cp -f /etc/sway/config "$SWAY/"
# Make it load additional config files.
echo "include $HOME/.config/sway/*.conf" >> "$SWAY/config"
# Copy additional config files.
cp -t "$SWAY" "$ROOT"/sway/*.conf
# TODO: Check ctrl:swapcaps
}
install_aur() {
# Install dependencies of emacs
sudo pacman -Sy --noconfirm --overwrite '*' --asdeps \
acl \
alsa-lib \
dbus \
fontconfig \
freetype2 \
gdk-pixbuf2 \
giflib \
glib2 \
gmp \
gnutls \
gpm \
gtk3 \
harfbuzz \
jansson \
lcms2 \
libgccjit \
libice \
libjpeg-turbo \
libotf \
libpng \
librsvg \
libsm \
libtiff \
libxfixes \
libxml2 \
m17n-lib \
ncurses \
pango \
tree-sitter \
zlib
mkdir -p ~/local/aur
(
cd ~/local/aur
wget https://aur.archlinux.org/cgit/aur.git/snapshot/emacs-git.tar.gz
tar xf emacs-git.tar.gz
(
cd emacs-git
makepkg -i
)
)
# TODO: Install these packages too!
# ttf-courier-prime
# ttf-google-fonts-git
# ttf-monaco
# ttf-ms-fonts
}
install_packages() {
# It's nice if some packages get installed during the installation
# phase:
#
# $ pacstrap /mnt dhcpcd git sudo vi iwd
# - or, after arch-chroot -
# $ pacman -S dhcpcd git sudo vi iwd
#
# Adding a user: useradd -m -G wheel,input -s /bin/bash <handle>
#
mkdir -p ~/.config
# System
#
# Installs https://archlinux.org/groups/x86_64/xorg-apps/
sudo pacman -Sy --noconfirm --overwrite '*' \
alacritty \
aspell-en \
pulseaudio \
qt \
xorg-apps \
xorg-xclock
# System misc
sudo pacman -Sy --noconfirm --overwrite '*' \
dhcpcd \
iw \
man \
man-pages \
openssh \
pacman-contrib \
tmux
# Programming.
#
# base-devel installs: binutils, gcc, gettext libtool pkgconf
# https://archlinux.org/groups/x86_64/base-devel/
sudo pacman -Sy --noconfirm --overwrite '*' \
base-devel \
clang \
cmake \
gdb \
valgrind
# Programming languages.
sudo pacman -Sy --noconfirm --overwrite '*' \
go \
nodejs \
rustup
# Misc.
sudo pacman -Sy --noconfirm --overwrite '*' \
btop \
direnv \
fasd \
htop \
imagemagick \
iotop \
keepass \
p7zip \
pavucontrol \
postgresql \
ripgrep \
tree \
unzip \
vlc \
wget \
xclip
# Install fonts.
sudo pacman -Sy --noconfirm --overwrite '*' \
gnu-free-fonts \
ttf-cascadia-code \
ttf-dejavu \
ttf-hack \
ttf-ubuntu-font-family
# Misc GUI.
sudo pacman -Sy --noconfirm --overwrite '*' \
firefox \
gimp \
transmission-gtk
# Set Firefox as the default web browser.
xdg-settings set default-web-browser firefox.desktop
}
install_rust() {
# $ rustup default stable
# info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
# info: installing component 'cargo'
# info: installing component 'clippy'
# info: installing component 'rust-docs'
# info: installing component 'rust-std'
# info: installing component 'rustc'
# info: installing component 'rustfmt'
# stable-x86_64-unknown-linux-gnu installed
# Here's a list of the components:
# https://rust-lang.github.io/rustup/concepts/components.html
#
# Here's what's installed by default:
# - cargo
# - clippy
# - rust-docs
# - rust-stc
# - rustc
# - rustfmt
#
# Here's what's not installed:
# - rust-analyzer
# - rls
# - miri
# - rust-src
# - rust-analysis
# - rust-mingw
# - llvm-tools-preview
# - rust-dev
#
# Here's the list of all the valid proxy names for rustup:
# - rustc [+]
# - rustdoc [+ rust-docs]
# - cargo [+]
# - rust-lldb
# - rust-gdb
# - rust-gdbgui
# - rls [-]
# - cargo-clippy [+ clippy]
# - clippy-driver [+ clippy}
# - cargo-miri [+ cargo]
# - rustfmt [+]
# - cargo-fmt [+ cargo]
rustup default stable
rustup toolchain install stable --component rust-analyzer rust-src rust-analysis
}
install_x() {
sudo pacman -Sy
sudo pacman -S --noconfirm --overwrite '*' \
i3 \
xorg \
xorg-xinit \
xterm
}
install_sway() {
sudo pacman -S --noconfirm --overwrite '*' --asdeps \
bemenu \
dmenu \
i3status \
mako \
slurp \
swaybg \
swayidle \
swaylock \
wallutils \
waybar \
wayland \
xorg-wayland
sudo pacman -S --noconfirm --overwrite '*' \
brightnessctl \
foot \
grim \
sway
# TODO: Install polkit?
# These two are needed for my fancy swaybar status.sh.
sudo pacman -S --noconfirm --overwrite '*' --asdeps \
acpi noto-fonts-emoji
}
install_tools() {
sudo pacman -Sy
# TODO: Install golangci-lint?
# TODO: Install multisol from cargo?
sudo pacman -Sy --noconfirm --overwrite '*' \
delve \
gopls \
yarn \
npm \
pyright \
typescript-language-server
}
if [ $# -eq 0 ] || [ "$1" = "help" ] ; then
usage
else
for arg in "$@" ; do
if [[ "${COMMANDS[*]}" =~ $arg ]]; then
$arg
else
die "unrecognized command:" "$arg"
fi
done
fi