-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
Β·247 lines (217 loc) Β· 8.54 KB
/
setup
File metadata and controls
executable file
Β·247 lines (217 loc) Β· 8.54 KB
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
#!/usr/bin/env bash
set -euo pipefail
# =============================================================================
# Utilities
# =============================================================================
# Colors
readonly RED='\033[0;31m'
readonly GREEN='\033[0;32m'
readonly YELLOW='\033[0;33m'
readonly BLUE='\033[0;34m'
readonly MAGENTA='\033[0;35m'
readonly CYAN='\033[0;36m'
readonly RESET='\033[0m'
readonly BOLD='\033[1m'
readonly DIM='\033[2m'
# Layout
readonly INDENT=' '
# Logging
print_banner() {
clear
echo ""
echo -e "${YELLOW} βββ ββββββ βββββββ ββββββ βββ βββββββ βββ ββββββββ${RESET}"
echo -e "${YELLOW} βββ βββββββ ββββββββ ββββββ βββββββββββββββ ββββββββ${RESET}"
echo -e "${YELLOW} βββββββ βββ βββββββββ ββββββ ββ ββββββ ββββββ ββββββ${RESET}"
echo -e "${YELLOW} βββββββ ββββ βββββββββββββββββββββββββββ ββββββ ββββββ${RESET}"
echo -e "${YELLOW} βββ βββ βββββββ βββ ββββββββββββββββββββββββββββββββββββ${RESET}"
echo -e "${YELLOW} βββ βββ βββββ βββ βββββ ββββββββ βββββββ βββββββββββ${RESET}"
echo ""
echo -e "${YELLOW} βββ βββ βββββββ βββββββ βββ ββββββββββββββββββ ββββββ βββββββββββββββ${RESET}"
echo -e "${YELLOW} βββ βββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββββββββββββ${RESET}"
echo -e "${YELLOW} βββ ββ ββββββ ββββββββββββββββββ βββββββββββββββββββββββββββ ββββββ${RESET}"
echo -e "${YELLOW} βββββββββββββ ββββββββββββββββββ βββββββββββββββ βββββββββββ ββββββ${RESET}"
echo -e "${YELLOW} ββββββββββββββββββββββ ββββββ ββββββββββββββ βββ βββββββββββββββββββ${RESET}"
echo -e "${YELLOW} ββββββββ βββββββ βββ ββββββ ββββββββββββββ βββ βββ βββββββββββββββ${RESET}"
echo ""
echo -e "${INDENT}You're about to configure your workspace with my setup, tools, and preferences."
echo -e "${INDENT}Questions or feedback? Reach me at ${MAGENTA}hi@kvnwolf.com${RESET}"
echo -ne "\n${INDENT}${DIM}Press ${BOLD}ENTER${RESET}${DIM} to continue or ${BOLD}ESC${RESET}${DIM} to abort.${RESET}"
while true; do
read -rsn1 key
if [[ "$key" == "" ]]; then
echo -ne "\r\033[K\033[1A"
break
elif [[ "$key" == $'\x1b' ]]; then
echo -ne "\r\033[K"
print_info "Setup aborted."
exit 0
fi
done
}
print_header() {
echo -e "\n${INDENT}${BLUE}β${RESET} ${BOLD}$1${RESET}"
}
print_success() {
echo -e "${INDENT}${GREEN}β${RESET} $1"
}
print_error() {
echo -e "${INDENT}${RED}β${RESET} $1" >&2
}
print_warning() {
echo -e "${INDENT}${YELLOW}β ${RESET} $1"
}
print_info() {
echo -e "${INDENT}${CYAN}βΉ${RESET} $1"
}
print_description() {
echo -e "${INDENT}${DIM}$1${RESET}"
}
# OS Detection
is_macos() {
[[ "$OSTYPE" == "darwin"* ]]
}
is_linux() {
[[ "$OSTYPE" == "linux-gnu"* ]]
}
# Helpers
command_exists() {
command -v "$1" >/dev/null 2>&1
}
should_continue() {
echo -ne "\n${INDENT}${DIM}Press ${BOLD}ENTER${RESET}${DIM} to continue or ${BOLD}ESC${RESET}${DIM} to skip.${RESET}"
while true; do
read -rsn1 key
if [[ "$key" == "" ]]; then
echo -ne "\r\033[K\033[1A"
return 0
elif [[ "$key" == $'\x1b' ]]; then
echo -ne "\r\033[K\033[1A"
return 1
fi
done
}
# =============================================================================
# Welcome
# =============================================================================
WORKSPACE_SETUP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
print_banner
# =============================================================================
# macOS Setup
# =============================================================================
if is_macos; then
print_header "System Defaults"
print_description "Configures macOS system preferences for a better development experience."
if should_continue; then
echo ""
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock show-recents -bool false
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
defaults write com.apple.finder FXPreferredViewStyle -string "clmv"
defaults write NSGlobalDomain InitialKeyRepeat -int 15
defaults write NSGlobalDomain KeyRepeat -int 2
killall Dock Finder 2>/dev/null || true
print_success "macOS defaults applied"
else
echo ""
print_info "Skipped"
fi
print_header "Homebrew Packages"
print_description "Installs CLI tools and GUI apps from Brewfile."
if should_continue; then
if ! command_exists brew; then
echo ""
print_info "Installing Homebrew..."
bash <(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)
eval "$(/opt/homebrew/bin/brew shellenv)"
print_success "Homebrew installed"
else
echo ""
print_success "Homebrew already installed"
fi
echo ""
print_info "Installing packages from Brewfile..."
brew update --quiet
brew upgrade --quiet
brew bundle --file="${WORKSPACE_SETUP_DIR}/macos/Brewfile" --quiet
brew cleanup --quiet
print_success "Packages installed"
else
echo ""
print_info "Skipped"
fi
if [[ -d "${WORKSPACE_SETUP_DIR}/macos/home" ]]; then
print_header "macOS Dotfiles"
print_description "Creates symlinks for macOS-specific configuration files."
if should_continue; then
echo ""
stow --no-folding -d "${WORKSPACE_SETUP_DIR}/macos" -t ~ home
print_success "macOS dotfiles stowed"
else
echo ""
print_info "Skipped"
fi
fi
fi
# =============================================================================
# Linux Setup
# =============================================================================
if is_linux; then
print_error "Linux setup not implemented yet"
exit 1
fi
# =============================================================================
# Shared Setup
# =============================================================================
if [[ -d "${WORKSPACE_SETUP_DIR}/shared/home" ]]; then
print_header "Shared Dotfiles"
print_description "Creates symlinks for cross-platform configuration (fish, git, starship)."
if should_continue; then
echo ""
stow --no-folding -d "${WORKSPACE_SETUP_DIR}/shared" -t ~ home
print_success "Shared dotfiles stowed"
else
echo ""
print_info "Skipped"
fi
fi
if command_exists ya; then
print_header "Yazi Plugins"
print_description "Installs plugins and flavors defined in yazi's package.toml."
if should_continue; then
echo ""
ya pack -i
print_success "Yazi plugins installed"
else
echo ""
print_info "Skipped"
fi
fi
if command_exists bun; then
print_header "Bun Global Packages"
print_description "Installs global packages via bun (e.g. Claude Code)."
if should_continue; then
echo ""
bun install -g @anthropic-ai/claude-code
print_success "Bun global packages installed"
else
echo ""
print_info "Skipped"
fi
fi
if command_exists fish; then
print_header "Default Shell"
print_description "Changes your login shell to fish."
if should_continue; then
echo ""
fish_path=$(which fish)
if ! grep -q "$fish_path" /etc/shells; then
print_info "Adding fish to /etc/shells..."
echo "$fish_path" | sudo tee -a /etc/shells
fi
chsh -s "$fish_path"
print_success "Default shell changed to fish"
else
echo ""
print_info "Skipped"
fi
fi