-
Notifications
You must be signed in to change notification settings - Fork 2
/
install
executable file
·273 lines (203 loc) · 8.23 KB
/
install
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
#!/bin/zsh
GREEN='\033[1;32m'
BLUE='\033[1;34m'
RED='\033[1;91m'
RESET='\033[0m'
WD=$(pwd)
DEV_DOTFILES=~/Developer/frm/dotfiles
MAC_OS_MOJAVE_HEADERS=/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
DEFAULT_ASDF_VERSION=0.13.1
function pp {
echo -e "\n$1[$2]: $3${RESET}"
}
function pp_info {
pp $BLUE $1 $2
}
function pp_success {
pp $GREEN $1 $2
}
function pp_error {
pp $RED $1 $2
}
function dirlink {
(cd $HOME && ln -s "$WD/$1" "$2")
}
pp_info "install" "setting up Developer directory"
mkdir -p ~/Developer/frm
git clone --recurse-submodules -j8 https://github.com/frm/dotfiles.git $DEV_DOTFILES
cd $DEV_DOTFILES
pp_info "install" "installing brew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
PATH="$PATH:/opt/homebrew/bin"
pp_info "brew" "bundling apps"
brew bundle
pp_info "macos" "installing command line tools"
xcode-select --install
MAC_OS_VERSION=$(sw_vers -productVersion)
if [[ $MAC_OS_VERSION =~ "10.14" ]]; then
pp_info "macos" "installing macos mojave headers"
if [ ! -f $MAC_OS_MOJAVE_HEADERS ]; then
pp_error "macos" "failed installing Mojave SDK headers"
pp_error "macos" "please download them from https://developer.apple.com/download/more/?q=Command%20Line%20Tools"
exit 1
else
sudo installer -pkg $MAC_OS_MOJAVE_HEADERS -target /
fi
else
pp_info "macos" "not using mojave, skipping headers"
fi
pp_info "macos" "accepting developer license"
sudo xcodebuild -license accept
pp_info "macos" "setting up system configs"
read_hostname=$(pp $RESET "macos" "enter your desired hostname (default: da3mon) ")
read -r "hostname?$read_hostname"
hostname=${hostname:-da3mon}
./macos/setup "$hostname"
pp_info "install" "checking if gnu ln is available"
if which gln > /dev/null; then
pp_info "install" "found gln, using it"
else
pp_error "install" "gnu ln not found"
pp_error "install" "can't create symlinks without gln"
pp_error "install" "please install coreutils and try again"
exit 1
fi
pp_info "asdf" "setting up environment"
gln -srf asdf/asdfrc.symlink ~/.asdfrc
read -r "asdf_version?$(pp $RESET "asdf" "asdf version to install? (default: $DEFAULT_ASDF_VERSION)") "
asdf_version=${asdf_version:-$DEFAULT_ASDF_VERSION}
pp_info "asdf" "installing asdf $asdf_version"
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v$asdf_version
pp_info "asdf" "resourcing environment"
source ~/.asdf/asdf.sh
pp_info "asdf" "adding plugins"
asdf plugin-add elixir
asdf plugin-add erlang
asdf plugin-add ruby
asdf plugin-add rust
asdf plugin-add python
asdf plugin-add nodejs
asdf plugin-add crystal
asdf plugin-add golang
asdf plugin-add postgres
asdf plugin-add kubectl
asdf plugin-add flutter
asdf plugin-add cocoapods
asdf_check=$(pp $RESET "asdf" "check if the asdf/tool-versions.symlink file contains the desired language versions and press ENTER when ready ")
read -r "_unused?$asdf_check"
gln -srf asdf/tool-versions.symlink ~/.tool-versions
# Ensure postgres is configured
export POSTGRES_EXTRA_CONFIGURE_OPTIONS="
--with-lz4
--with-uuid=e2fs
--with-libraries=/usr/local/lib:$(brew --prefix [email protected])/lib
--with-includes=/usr/local/include:$(brew --prefix [email protected])/include"
brew install icu4c
brew link icu4c --force
asdf install
source $HOME/.asdf/shims
pp_info "elixir" "setting up iex"
gln -srf elixir/iex.exs.symlink ~/.iex.exs
pp_info "ruby" "installing gems"
gem install bundler
cat ruby/default-gems | xargs gem install
pp_info "node" "installing packages"
npm install -g node
pp_info "python" "upgrading pip"
pip install --upgrade pip
pp_info "python" "installing packages"
pip install -r python/requirements.txt
pp_info "zsh" "replacing system zsh with brew version"
sudo sh -c "echo $(which zsh) >> /etc/shells"
chsh -s $(which zsh)
pp_info "zsh" "setting up environment"
dirlink . ~/.dotfiles
cp ./system/secrets.init.sample ./system/secrets.init
pp_info "zsh" "replacing current zshrc"
if [ -f ~/.zshrc ]; then
rm ~/.zshrc
fi
gln -srf zsh/zshrc.symlink ~/.zshrc
source $HOME/.dotfiles/system/env.init
pp_info "zsh" "setting up themes"
mkdir -p ~/.config/fsh
for variant in frappe latte macchiato mocha; do
wget -O "$DOTFILES/zsh/themes/catppuccin-$variant.ini" "https://raw.githubusercontent.com/catppuccin/zsh-fsh/main/themes/catppuccin-$variant.ini"
gln -srf "$DOTFILES/zsh/themes/catppuccin-$variant.ini" "$HOME/.config/fsh/catppuccin-$variant.ini"
done
fast-theme XDG:catppuccin-$CATPPUCCIN_VARIANT
pp_info "tmux" "installing plugins"
mkdir -p ~/.tmux/plugins/
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
gln -srf ./tmux/tmux.conf.symlink "$HOME/.tmux.conf"
gln -srf ./tmux/tmate.conf.symlink "$HOME/.tmate.conf"
~/.tmux/plugins/tpm/bin/install_plugins
pp_info "git" "setting up environment"
gln -srf git/gitconfig.symlink ~/.gitconfig
gln -srf git/gitignore_global.symlink ~/.gitignore_global
gln -srf git/gitattributes.symlink ~/.gitattributes
dirlink git/git_template ~/.git_template
pp_info "gnupg" "setting up gpg config"
mkdir -p ~/.gnupg
gln -srf gnupg/gpg-agent.conf.symlink ~/.gnupg/gpg-agent.conf
pp_info "fzf" "setting up fzf"
$(brew --prefix)/opt/fzf/install
pp_info "nvim" "setting up environment"
mkdir ~/.config
dirlink nvim ~/.config/
pip install neovim
gem install neovim
yarn global add neovim
pp_info "nvim" "fixing C-h bug"
$DEV_DOTFILES/scripts/fix-nvim-c-h
pp_info "ctags" "installing elixir ctags"
wget https://raw.githubusercontent.com/mmorearty/elixir-ctags/master/.ctags -q -O ctags/elixir.ctags
pp_info "ctags" "setting up ctags environment"
dirlink ctags ~/.ctags.d
pp_info "luarocks" "setting up lua env"
cat lua/deps | xargs -I {} luarocks install --server=https://luarocks.org/dev {}
pp_info "bat" "installing custom theme"
mkdir -p "$(bat --config-dir)/themes/tranquility"
mkdir -p "$(bat --config-dir)/themes/mountaineer"
mkdir -p "$(bat --config-dir)/themes/dracula"
mkdir -p "$(bat --cache-dir)"
gln -sfr bat/tranquility.tmTheme "$(bat --config-dir)/themes/tranquility"
gln -sfr bat/tranquility_eighties.tmTheme "$(bat --config-dir)/themes/tranquility"
gln -sfr bat/mountaineer.tmTheme "$(bat --config-dir)/themes/mountaineer"
curl \
-o \
"$(bat --config-dir)/themes/dracula/dracula.tmTheme" \
https://raw.githubusercontent.com/dracula/sublime/master/Dracula.tmTheme
for variant in frappe latte macchiato mocha; do
mkdir -p "$(bat --config-dir)/themes/Catppuccin-$variant"
curl \
-o \
"$(bat --config-dir)/themes/Catppuccin-$variant/Catppuccin-$variant.tmTheme" \
"https://raw.githubusercontent.com/catppuccin/bat/main/Catppuccin-$variant.tmTheme"
done
bat cache --build
pp_info "starship" "installing custom themes"
mkdir -p $DOTFILES/starship/themes/catppuccin/
for variant in frappe latte macchiato mocha; do
curl \
-o \
"$DOTFILES/starship/themes/catppuccin/$variant" \
"https://raw.githubusercontent.com/catppuccin/starship/main/palettes/$variant.toml"
done
pp_info "kitty" "installing custom themes"
for variant in Frappe Latte Macchiato Mocha; do
kitty +kitten themes --dump-theme "Catppuccin-$variant" > "$DOTFILES/kitty/Catppuccin-$variant.conf"
done
pp_info "fonts" "installing fira code"
cd ~/Downloads
mkdir fonts
cd fonts
for type in Light Retina Regular Medium Bold SemiBold; do
wget -O "FiraCode $type Nerd Font Complete Mono.ttf" "https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/FiraCode/$type/FiraCodeNerdFontMono-$type.ttf?raw=true"
wget -O "FiraCode $type Nerd Font Complete Mono.ttf" "https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/FiraCode/$type/FiraCodeNerdFont-$type.ttf?raw=true"
done
mv ./*.ttf ~/Library/Fonts/
cd $WD
pp_info "gh" "installing gh extensions..."
cat gh/extensions | xargs -I {} gh extension install {}
pp_success "install" "automatic config done!"