forked from jrmysvr/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·272 lines (236 loc) · 6.35 KB
/
setup.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
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
#!/usr/bin/env bash
#------------------------
# Install Apt Packages
#------------------------
setup_apt() {
sudo apt update && sudo apt install -y \
build-essential \
cmake \
curl \
git \
vim \
neovim \
python3 \
python3-dev \
python3-pip \
python3-venv \
openssh-server \
openssh-client \
tmux \
xbacklight \
alsa-tools \
pulseaudio-utils \
pavucontrol \
libnotify-bin \
htop \
maim \
feh \
locate \
acpi \
rofi \
shellcheck \
brightnessctl \
tlp
}
# TLP
# https://linrunner.de/tlp/faq/operation.html#system-freezes-on-wakeup-from-suspend-on-battery
# AHCI_RUNTIME_PM_ON_BAT=on
#------------------------
# Install Other Packages
#------------------------
setup_i3wm() {
sudo apt update && sudo apt install -y i3 i3blocks
if which python3; then
# https://pypi.org/project/i3-resurrect/#getting-started
python3 -m pip install --upgrade i3-resurrect psutil
fi
}
setup_sway() {
sudo apt update && sudo apt install -y sway
}
# Tailscale
# https://tailscale.com/download
setup_tailscale() {
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.noarmor.gpg | sudo tee /usr/share/keyrings/tailscale-archive-keyring.gpg >/dev/null
curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.tailscale-keyring.list | sudo tee /etc/apt/sources.list.d/tailscale.list
sudo apt update && sudo apt install tailscale
## Authenticate
# sudo tailscale up
## Show Tailscale IP
# ip addr show tailscale0
}
# Rust
# https://www.rust-lang.org/tools/install
setup_rust() {
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
}
# Nim
# https://github.com/dom96/choosenim#unix
setup_nim() {
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
}
# SBCL
# https://lisp-lang.org/learn/getting-started/
setup_sbcl() {
# sudo apt install sbcl
return 1
}
# Guile
# https://www.gnu.org/software/guile/download/
setup_guile() {
# sudo apt install guile-3.0
return 1
}
# Dr. Racket (just handle in Docker?)
# sudo add-apt-repository ppa:plt/racket && sudo apt update && sudo apt install racket
# Haskell
# https://docs.haskellstack.org/en/stable/install_and_upgrade/#ubuntu
setup_haskell() {
# sudo apt install stack -y && stack upgrade
return 1
}
# keybase
## Still kind of an unresolved issue: adding a new device on OS reinstall
setup_keybase() {
# curl --remote-name https://prerelease.keybase.io/keybase_amd64.deb
# sudo apt install ./keybase_amd64.deb
# run_keybase
return 1
}
# Docker
# https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
setup_docker() {
sudo apt remove docker docker-engine docker.io containerd runc
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update && sudo apt install docker-ce docker-ce-cli containerd.io
# Check if Docker installation succeeded
# sudo docker run hello_world
}
# croc
# https://github.com/schollz/croc
setup_croc() {
curl https://getcroc.schollz.com | bash
}
# nix
# https://nixos.org/download.html
setup_nix() {
curl -L https://nixos.org/nix/install | sh
}
# Chrome
#------------------------
# Link .dotfiles
#------------------------
## Shamelessly taken from https://github.com/tomnomnom/dotfiles/blob/master/setup.sh
dotfilesDir=$(pwd)
function link_dotfile {
target="$1"
dest_dir="$2"
dest="$dest_dir/$target"
dateStr=$(date +%Y-%m-%d-%H%M)
if [ -h "$dest" ]; then
# Existing symlink
echo "Removing existing symlink: $dest"
rm "$dest"
elif [ -f "$dest" ]; then
# Existing file
echo "Backing up existing file: $dest"
mv "$dest" "$dest.$dateStr"
elif [ -d "$dest" ]; then
# Existing dir
echo "Backing up existing dir: $dest"
mv "$dest" "$dest.$dateStr"
fi
echo "Creating new symlink: $dest"
ln -s "$dotfilesDir/$target" "$dest"
}
link_dotfiles() {
link_dotfile .vimrc "$HOME"
link_dotfile .bashrc "$HOME"
link_dotfile .config "$HOME"
}
setup_dotfiles() {
git submodule update --init --recursive
link_dotfiles
}
setup_vim() {
mkdir -p "$dotfilesDir/.vim/bundle"
cd "$dotfilesDir/.vim/bundle" || exit 1
git clone http://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
sudo apt install -y \
neovim \
nodejs \
npm
mkdir "$HOME/.npm-global"
npm config set prefix "$HOME/.npm-global"
}
setup_sdkman() {
curl -s "https://get.sdkman.io" | bash
}
#------------------------------------
do_thing() {
case $1 in
apt|--apt)
echo "Installing Apt Packages"
setup_apt
;;
rust|--rust)
echo "Installing Rust"
setup_rust
;;
nim|--nim)
echo "Installing Nim"
setup_nim
;;
tailscale|--tailscale)
echo "Installing Tailscale"
setup_tailscale
;;
docker|--docker)
echo "Installing Docker"
setup_docker
;;
sdkman|--sdkman)
echo "Installing sdkman"
setup_sdkman
;;
croc|--croc)
echo "Installing croc"
setup_croc
;;
nix|--nix)
echo "Installing Nix"
setup_nix
;;
dotfiles|--dotfiles)
echo "Setting up dotfiles"
setup_dotfiles
link_dotfiles
;;
vim|--vim)
echo "Setting up vim"
setup_vim
;;
*)
echo "Unsupported argument: \"$1\""
;;
esac
}
echo "-----------------------"
echo "Jeremy's computer setup"
echo "-----------------------"
if [ -z "$*" ]
then
echo "Nothing to do"
else
for thing in "$@"
do
do_thing "$thing"
done
fi
#------------------------------------