-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·165 lines (132 loc) · 3.86 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
#!/usr/bin/env zsh
# vim: foldmarker={,} foldmethod=marker
set -e
# This script installs all requirements.
# Setup {
export DOTFILE_FOLDER="${XDG_CONFIG_HOME:-${HOME:?}/.config}/dotfiles"
source "$DOTFILE_FOLDER/utils.zsh"
# }
# ZSH {
# Change to zsh
is_interactive && {
if [[ "$SHELL" != "$(which zsh)" ]]; then
sudo chsh -s $(which zsh)
fi
}
link "$DOTFILE_FOLDER/.zshrc" "$HOME/.zshrc"
link "$DOTFILE_FOLDER/.zprofile" "$HOME/.zprofile"
link "$DOTFILE_FOLDER/.zshenv" "$HOME/.zshenv"
link "$DOTFILE_FOLDER/.bashrc" "$HOME/.bashrc"
mkdir -p "$HOME/.local/bin"
# }
# Fonts {
unzip -q ./CommitMono.zip -d /tmp/commitmono/
# install https://github.com/ryanoasis/nerd-fonts/releases
is_macos && mv /tmp/commitmono/*.otf /Library/Fonts/
is_linux && {
mkdir -p ~/.local/share/fonts
mv /tmp/commitmono/*.otf ~/.local/share/fonts/
}
rm -rf /tmp/commitmono/
# }
# Homebrew {
if ! command -v brew &> /dev/null; then
open "https://brew.sh/"
wait_until "Homebrew is installed"
fi
brew bundle install
BREW_PREFIX=$(brew --prefix)
# }
# JQ {
# Making `jq` available for all process tho it's installed as `gojq`.
# This is somewhat easier than an alias or a function.
ln -s "${BREW_PREFIX}/bin/gojq" "${BREW_PREFIX}/bin/jq"
# }
# Linux base packages {
is_linux && {
sudo apt-get update
sudo apt-get install autoconf patch build-essential rustc libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libgmp-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev uuid-dev
}
# }
# Neovim {
link "$DOTFILE_FOLDER/nvim/" "$HOME/.config/nvim"
# }
# Git {
link "$DOTFILE_FOLDER/.gitconfig" "$HOME/.gitconfig"
link "$DOTFILE_FOLDER/.gitignore_global" "$HOME/.gitignore_global"
# }
# Tmux {
mkdir -p "$HOME/.config/tmux"
link "$DOTFILE_FOLDER/tmux.conf" "$HOME/.config/tmux/tmux.conf"
# }
# Install tmux plugin manager
if [ ! -d "$HOME/.config/tmux/plugins/tpm/" ]; then
git clone https://github.com/tmux-plugins/tpm "$HOME/.config/tmux/plugins/tpm"
fi
# }
# Ruby {
# Configure ruby with rbenv
ruby_latest="$(rbenv install -l | grep -v - | tail -1)"
rbenv install --skip-existing "$ruby_latest"
rbenv global "$ruby_latest"
link "$DOTFILE_FOLDER/.rubocop.yml" "$HOME/.rubocop.yml"
link "$DOTFILE_FOLDER/.pryrc" "$HOME/.pryrc"
# }
# Kitty {
link "$DOTFILE_FOLDER/kitty/" "$HOME/.config/kitty"
# }
# 1password cli {
is_linux && {
curl -o op.deb https://downloads.1password.com/linux/debian/amd64/stable/1password-cli-amd64-latest.deb
sudo dpkg --skip-same-version -i op.deb
rm op.deb
}
# }
# Espanso {
is_linux && {
if ! command -v espanso &> /dev/null; then
open "https://espanso.org/docs/install/linux/#install-on-x11"
wait_until "espanso is installed"
fi
}
# It's possible that this fails between installs, in which case forcing a clean
# reinstall seems to have solved the issue.
# brew uninstall espanso
# trash $HOME/Library/Application\ Support/espanso
espanso service register || true
espanso start
ESPANSO_CONFIG="$(espanso path config)"
trash "${ESPANSO_CONFIG}" || true
link "$DOTFILE_FOLDER/espanso/" "${ESPANSO_CONFIG}"
# }
# GPG {
is_macos && {
mkdir -p "$HOME/.gnupg"
echo "pinentry-program $BREW_PREFIX/bin/pinentry-mac" > "$HOME/.gnupg/gpg-agent.conf"
echo 'use-agent' > "$HOME/.gnupg/gpg.conf"
chmod 700 "$HOME/.gnupg"
}
# }
# OS-Specific {
is_macos && {
# ref: https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Default finder view: column
defaults write com.apple.Finder FXPreferredViewStyle clmv
# Show all files
defaults write com.apple.Finder AppleShowAllFiles true
# Show the $HOME/Library folder.
chflags nohidden "$HOME/Library"
}
# }
# misc {
"$BREW_PREFIX/opt/fzf/install" --bin --key-bindings
touch "$HOME/.z"
tldr --update
link "$DOTFILE_FOLDER/.vale.ini" "$HOME/.vale.ini"
link "$DOTFILE_FOLDER/hammerspoon/" "$HOME/.hammerspoon"
mkdir -p "$HOME/.config/gh"
link "$DOTFILE_FOLDER/gh-config.yml" "$HOME/.config/gh/config.yml"
# }
# Private {
./private/install.sh
# }