-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·193 lines (170 loc) · 6.23 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
#!/usr/bin/env bash
set -e
echo "Setting up config directories..."
mkdir -p ~/.config/nvim
mkdir -p ~/.config/alacritty
sudo mkdir -p /usr/local/opt
sudo chmod 777 /usr/local/opt
echo "Creating symbolic links of dotfiles..."
ln -srvf .zshrc ~/.zshrc
ln -srvf .gitconfig ~/.gitconfig
ln -srvf .gitignore_global ~/.gitignore_global
ln -srvf init.vim ~/.config/nvim/init.vim
ln -srvf alacritty.yml ~/.config/alacritty/alacritty.yml
ln -srvf .phoenix.js ~/.phoenix.js
ln -srvf .tmux.conf ~/.tmux.conf
if ! [ -x "$(command -v apt-get)" ]; then
echo "No apt-get found, assuming this is OSX. No need to apt-get update."
else
echo "Making sure apt-get is up to date..."
sudo apt-get update
sudo apt-get upgrade -y
fi
echo "Installing neovim Plug!"
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
if [[ -d /usr/local/opt/zplug ]]; then
echo "zplug already installed, skipping..."
else
echo "Installing zplug!"
curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh
fi
if [[ -d ~/.asdf ]]; then
echo "asdf already installed, skipping..."
else
echo "Installing asdf"
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.1
fi
. ~/.asdf/asdf.sh
if asdf plugin list | grep -q nodejs; then
echo "asdf nodejs plugin already installed, skipping..."
else
echo "Installing asdf nodejs plugin"
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
fi
echo "Installing asdf nodejs latest"
asdf install nodejs latest
asdf global nodejs latest
if asdf plugin list | grep -q ruby; then
echo "asdf ruby plugin already installed, skipping..."
else
echo "Installing asdf ruby plugin"
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
fi
echo "Installing asdf ruby latest"
if ! [ -x "$(command -v apt-get)" ]; then
echo "No apt-get found, assuming this is OSX."
echo "Installing ruby dev dependencies...Make sure you also have installed Xcode Command Line Tools and Homebrew."
brew install openssl readline
else
echo "Command apt-get found, assuming this is Linux."
echo "Installing ruby dev dependencies..."
sudo apt-get install -y autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev
fi
asdf install ruby 3.0.5
asdf global ruby 3.0.5
if asdf plugin list | grep -q golang; then
echo "asdf golang plugin already installed, skipping..."
else
echo "Installing asdf golang plugin"
asdf plugin-add golang https://github.com/kennyp/asdf-golang.git
fi
echo "Installing asdf golang latest"
asdf install golang latest
asdf global golang latest
if asdf plugin list | grep -q python; then
echo "asdf python plugin already installed, skipping..."
else
echo "Installing asdf python plugin"
asdf plugin-add python https://github.com/danhper/asdf-python.git
fi
echo "Installing asdf python latest"
asdf install python latest
asdf global python latest
echo "Installing python neovim support"
pip3 install neovim --upgrade
if asdf plugin list | grep -q neovim; then
echo "asdf neovim plugin already installed, skipping..."
else
echo "Installing asdf neovim plugin"
asdf plugin-add neovim https://github.com/richin13/asdf-neovim.git
fi
echo "Installing asdf neovim stable"
asdf install neovim stable
asdf global neovim stable
if asdf plugin list | grep -q tmux; then
echo "asdf tmux plugin already installed, skipping..."
else
echo "Installing asdf tmux plugin"
asdf plugin-add tmux https://github.com/aphecetche/asdf-tmux.git
fi
echo "Installing asdf tmux latest"
if ! [ -x "$(command -v apt-get)" ]; then
echo "No apt-get found, assuming this is OSX."
echo "Installing tmux dependencies..."
brew install unzip
else
echo "Command apt-get found, assuming this is Linux."
echo "Installing tmux dependencies..."
sudo apt-get install -y unzip
fi
asdf install tmux latest
asdf global tmux latest
if [[ -d ~/.tmux/plugins/tpm ]]; then
echo "tmux plugins already installed, skipping..."
else
echo "Installing tmux plugins"
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
if ! [ -x "$(command -v apt-get)" ]; then
echo "No apt-get found, assuming this is OSX."
echo "Installing silver searcher..."
brew install the_silver_searcher
else
echo "Command apt-get found, assuming this is Linux."
echo "Installing silver searcher..."
sudo apt-get install -y silversearcher-ag
fi
if ! [ -x "$(command -v fzf)" ]; then
echo "Installing fzf..."
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
else
echo "Command fzf found, skipping..."
fi
if ! [ -x "$(command -v docker)" ]; then
if ! [ -x "$(command -v apt-get)" ]; then
echo "No apt-get found, assuming this is OSX."
echo "Do manual install of Docker for Mac: https://docs.docker.com/desktop/mac/install/"
else
echo "Command apt-get found, assuming this is Linux."
echo "Installing docker engine..."
# Ref: https://docs.docker.com/engine/install/ubuntu/
sudo apt-get install -y \
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=$(dpkg --print-architecture) 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-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
echo "Installing docker compose..."
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# https://stackoverflow.com/a/48957722
sudo usermod -aG docker $USER
newgrp docker
fi
else
echo "Command docker found, skipping install..."
fi
echo "Install neovim providers..."
gem install neovim
npm install -g neovim
npm install -g typescript
# Ref: https://github.com/alacritty/alacritty/issues/4616#issuecomment-1236413444
echo "Disabling font smoothing for Alacritty..."
defaults write org.Alacritty AppleFontSmoothing -int 0
echo "Done."