-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·226 lines (187 loc) · 10.4 KB
/
install.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
#!/usr/bin/env bash
platform=$(uname -s)
arch=$(uname -m)
# Linux sudo requirements: bison build-essential cmake libevent-dev libncurses5-dev libssl-dev pkg-config
GLOW_VERSION=1.5.1
FISH_SHELL_VERSION=3.6.1
NODE_VERSION=v20.5.1
POETRY_VERSION=1.6.1
PYTHON_VERSION=3.11
TMUX_VERSION=3.3a
mkdir -p "$HOME"/.local/bin
#------------------------------------------------------------------------------#
# MacOSX #
#------------------------------------------------------------------------------#
if [ "$platform" == "Darwin" ]; then
intel=/usr/local
arm=/opt/homebrew
if [ "$arch" == "x86_64" ]; then
brew="$intel/bin/brew"
else
brew="$arm/bin/brew"
fi
#------------------------------------------------------------------------------#
# Homebrew #
#------------------------------------------------------------------------------#
if [ ! -f $brew ]; then
#export CI=1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
$brew install fish node glow fontconfig wget python@"$PYTHON_VERSION" wezterm helix brave-browser dbeaver-community discord firefox opera postman rectangle slack subler transmission vlc zoom tokei
$brew install --HEAD neovim
$brew tap finestructure/Hummingbird
$brew install finestructure/hummingbird/hummingbird
# brew upgrade --greedy
#------------------------------------------------------------------------------#
# Linux #
#------------------------------------------------------------------------------#
elif [ "$platform" == "Linux" ]; then
#------------------------------------------------------------------------------#
# Fish #
#------------------------------------------------------------------------------#
curl -LJO https://github.com/fish-shell/fish-shell/releases/download/"$FISH_SHELL_VERSION"/fish-"$FISH_SHELL_VERSION".tar.xz
tar -xf fish-"$FISH_SHELL_VERSION".tar.xz && rm fish-"$FISH_SHELL_VERSION".tar.xz
pushd fish-"$FISH_SHELL_VERSION" || exit
mkdir build
pushd build || exit
cmake -DCMAKE_INSTALL_PREFIX="$HOME"/.local ..
make && make install && popd || exit
popd || exit
rm -rf fish-"$FISH_SHELL_VERSION"
#------------------------------------------------------------------------------#
# TMUX #
#------------------------------------------------------------------------------#
curl -LJO https://github.com/tmux/tmux/releases/download/"$TMUX_VERSION"/tmux-"$TMUX_VERSION".tar.gz
tar -xf tmux-*.tar.gz && rm tmux-"$TMUX_VERSION".tar.gz
pushd tmux-*/ || exit
./configure --prefix="$HOME"/.local --enable-static
make && make install && popd || exit
rm -rf tmux-*/
# Add Terminfo for tmux:
curl https://gist.githubusercontent.com/nicm/ea9cf3c93f22e0246ec858122d9abea1/raw/37ae29fc86e88b48dbc8a674478ad3e7a009f357/tmux-256color | /usr/bin/tic -x -
#------------------------------------------------------------------------------#
# Glow #
#------------------------------------------------------------------------------#
curl -LJO https://github.com/charmbracelet/glow/releases/download/"$GLOW_VERSION"/glow_Linux_x86_64.tar.gz
tar -xf glow_Linux_x86_64.tar.gz && rm glow_Linux_x86_64.tar.gz
mv ./glow "$HOME"/.local/bin/glow
#------------------------------------------------------------------------------#
# Neovim #
#------------------------------------------------------------------------------#
curl -LJO https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage
chmod u+x nvim.appimage
mv nvim.appimage "$HOME"/.local/bin/nvim
#------------------------------------------------------------------------------#
# Nodejs #
#------------------------------------------------------------------------------#
curl -LJO https://nodejs.org/dist/"$NODE_VERSION"/node-"$NODE_VERSION"-linux-x64.tar.xz
tar -xf node-"$NODE_VERSION"-linux-x64.tar.xz && rm node-"$NODE_VERSION"-linux-x64.tar.xz
mv node-"$NODE_VERSION"-linux-x64 "$HOME"/.local/node
fi
#------------------------------------------------------------------------------#
# .config files #
#------------------------------------------------------------------------------#
if [ ! -d "$HOME"/.config ]; then
mkdir -p "$HOME"/.config
fi
for folder in "$HOME"/.dotfiles/*/; do
ln -fs "$folder" "$HOME"/.config/ || (rm -rf "$HOME"/.config/"$(basename "$folder")" && ln -fs "$folder" "$HOME"/.config/)
done
#------------------------------------------------------------------------------#
# SSH #
#------------------------------------------------------------------------------#
if [ ! -d "$HOME"/.ssh ]; then
mkdir -p "$HOME"/.ssh
fi
cp "$HOME"/.dotfiles/ssh/* "$HOME"/.ssh
chmod 700 "$HOME"/.ssh
chmod 600 "$HOME"/.ssh/*
#------------------------------------------------------------------------------#
# Cargo/Rust #
#------------------------------------------------------------------------------#
if [ ! -d "$HOME"/.cargo ]; then
mkdir -p "$HOME"/.cargo
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path
cargo=$HOME/.cargo/bin/cargo
PATH=/opt/homebrew/bin:$PATH $cargo install --locked eza ripgrep sd bat fd-find du-dust nu starship || exit
git clone https://github.com/crescentrose/sunshine
pushd sunshine || exit
$cargo install --path .
success=$?
popd && rm -rf sunshine
test $success -ne 0 && exit
fi
#------------------------------------------------------------------------------#
# Miniconda #
#------------------------------------------------------------------------------#
if [ ! -d "$HOME"/.miniconda3 ]; then
if [ "$platform" == "Darwin" ]; then
platform_name=MacOSX
elif [ "$platform" == "Linux" ]; then
platform_name=Linux
fi
url_prefix=https://repo.anaconda.com/miniconda
curl -L $url_prefix/Miniconda3-latest-"$platform_name"-"$arch".sh -o miniconda.sh
bash miniconda.sh -b -p "$HOME"/.miniconda3
rm miniconda.sh
"$HOME"/.miniconda3/bin/conda install --yes python="$PYTHON_VERSION" --channel conda-forge
"$HOME"/.miniconda3/bin/conda create --yes --name neovim python="$PYTHON_VERSION" --channel conda-forge
"$HOME"/.miniconda3/envs/neovim/bin/pip install pynvim
fi
#------------------------------------------------------------------------------#
# Poetry #
#------------------------------------------------------------------------------#
if [ ! -f "$HOME"/.local/bin/poetry ]; then
curl -sSL https://install.python-poetry.org | POETRY_VERSION="$POETRY_VERSION" "$HOME"/.miniconda3/bin/python3 - --yes
fi
#------------------------------------------------------------------------------#
# Direnv #
#------------------------------------------------------------------------------#
if [ ! -f "$HOME"/.local/bin/direnv ]; then
curl -sfL https://direnv.net/install.sh | bin_path=~/.local/bin bash
fi
#------------------------------------------------------------------------------#
# Wezterm #
#------------------------------------------------------------------------------#
# Add Terminfo for wezterm:
tempfile=$(mktemp) &&
curl -o "$tempfile" https://raw.githubusercontent.com/wez/wezterm/main/termwiz/data/wezterm.terminfo &&
/usr/bin/tic -x -o ~/.terminfo "$tempfile" &&
rm "$tempfile"
#------------------------------------------------------------------------------#
# FantasqueSansMono Nerd Font #
#------------------------------------------------------------------------------#
# https://github.com/be5invis/Iosevka # To try
mkdir FantasqueSansMono
curl -JLO https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FantasqueSansMono.tar.xz
tar --directory FantasqueSansMono -xf FantasqueSansMono.tar.xz && rm -rf FantasqueSansMono.tar.xz
if [ "$platform" == "Darwin" ]; then
mkdir -p "$HOME"/Library/Fonts
font_dest=$HOME/Library/Fonts
elif [ "$platform" == "Linux" ]; then
mkdir -p "$HOME"/.local/share/fonts
font_dest=$HOME/.local/share/fonts
fi
cp FantasqueSansMono/FantasqueSansMNerdFont-*.ttf "$font_dest"
fc-cache -f -v
rm -rf FantasqueSansMono
#------------------------------------------------------------------------------#
# Git stuff #
#------------------------------------------------------------------------------#
for folder in "$HOME"/*/; do
ln -sf "$HOME"/.dotfiles/git/pre-commit "${folder%/*}"/.git/hooks/
done
sed "s/<<EMAIL>>/$(git log | head -2 | "$HOME"/.cargo/bin/rg Author | sed -r 's/.*<(.*)>.*/\1/')/" "$HOME"/.dotfiles/git/gitconfig >"$HOME"/.gitconfig
#------------------------------------------------------------------------------#
# Theme #
#------------------------------------------------------------------------------#
if [ "$platform" == "Darwin" ]; then
echo "Run the following command to enable theme daemons"
echo "sudo cp $HOME/.dotfiles/theme/dotfiles.theme.plist /Library/LaunchDaemons/"
echo "sudo launchctl load /Library/LaunchDaemons/dotfiles.theme.plist"
# To test: sudo launchctl unload /Library/LaunchDaemons/dotfiles.theme.plist && sudo launchctl load /Library/LaunchDaemons/dotfiles.theme.plist && sudo launchctl list | rg dotfiles
elif [ "$platform" == "Linux" ]; then
crontab -l | cat - "$HOME"/.dotfiles/theme/crontab | crontab -
# Do not display login message
touch "$HOME"/.hushlogin
fi