Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
240 lines (208 loc) · 9.74 KB
/
Copy pathMakefile
File metadata and controls
240 lines (208 loc) · 9.74 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
.PHONY: all check-prerequisites check-homebrew check-xcode backup symlink install-tmux \
brew-update brew-installs brew-install-terraform brew-install-alacritty \
brew-install-ripgrep-fzf brew-install-gh brew-install-node brew-install-nvim brew-install-fonts \
brew-install-raycast brew-install-leader-key install-opencode install-claude-code install-oh-my-zsh install-nvim-plugins install-python-linters install-python-lsps \
turn-off-macos-dock-bounce configure-claude clean clean-nvim verify
# Detect architecture: Apple Silicon vs Intel
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_M),arm64)
HOMEBREW_PREFIX := /opt/homebrew
else
HOMEBREW_PREFIX := /usr/local
endif
all: check-prerequisites brew-installs install-oh-my-zsh install-tmux symlink install-nvim-plugins install-python-linters install-opencode install-claude-code configure-claude turn-off-macos-dock-bounce
@echo "✓ Setup complete!"
check-prerequisites: check-xcode check-homebrew
@mkdir -p ~/.config
@echo "✓ Prerequisites satisfied"
check-xcode:
@if ! xcode-select -p &>/dev/null; then \
echo "Installing Xcode Command Line Tools..."; \
xcode-select --install; \
echo "Please re-run 'make all' after installation completes."; \
exit 1; \
fi
@echo "✓ Xcode CLT installed"
check-homebrew:
@if ! command -v brew &>/dev/null; then \
echo "Installing Homebrew..."; \
/bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; \
echo "Please restart your terminal and re-run 'make all'"; \
exit 1; \
fi
@echo "✓ Homebrew installed ($(HOMEBREW_PREFIX))"
BACKUP_DIR := ~/.dotfiles_backup/$(shell date +%Y%m%d_%H%M%S)
backup:
@echo "Backing up existing configs to $(BACKUP_DIR)..."
@mkdir -p $(BACKUP_DIR)
@for f in ~/.zshrc ~/.tmux.conf ~/.amethyst.yml ~/.config/alacritty ~/.config/nvim ~/.claude/statusline.sh; do \
if [ -e "$$f" ] && [ ! -L "$$f" ]; then \
cp -r "$$f" $(BACKUP_DIR)/ 2>/dev/null && echo " Backed up $$f"; \
fi; \
done
@echo "✓ Backup complete"
symlink: backup
@echo "Creating symlinks..."
ln -sf $(shell pwd)/.zshrc ~/.zshrc
ln -sf $(shell pwd)/.tmux.conf ~/.tmux.conf
ln -sfn $(shell pwd)/alacritty ~/.config/alacritty
ln -sfn $(shell pwd)/nvim ~/.config/nvim
ln -sf $(shell pwd)/.amethyst.yml ~/.amethyst.yml
@mkdir -p ~/.claude ~/.claude/themes
ln -sf $(shell pwd)/claude/statusline.sh ~/.claude/statusline.sh
@mkdir -p ~/.tmux
ln -sf $(shell pwd)/tmux/status-right.sh ~/.tmux/status-right.sh
ln -sf $(shell pwd)/claude/themes/solarized-blend.json ~/.claude/themes/solarized-blend.json
@if [ ! -f ~/.zshrc.local ]; then \
cp $(shell pwd)/.zshrc.local.example ~/.zshrc.local; \
echo " Created ~/.zshrc.local from example — fill in real secrets"; \
fi
@echo "✓ Symlinks created"
# settings.json holds account-specific secrets, so it isn't tracked; we merge
# only the sharable keys from settings.partial.json into it. See
# claude/merge-settings.jq for how hooks are preserved rather than replaced.
configure-claude:
@echo "Configuring Claude Code (merging tracked prefs)..."
@brew list jq &>/dev/null || brew install jq || true
@mkdir -p ~/.claude
@[ -s ~/.claude/settings.json ] || echo '{}' > ~/.claude/settings.json
@tmp=$$(mktemp) && jq -s -f $(shell pwd)/claude/merge-settings.jq ~/.claude/settings.json $(shell pwd)/claude/settings.partial.json > "$$tmp" && mv "$$tmp" ~/.claude/settings.json
@echo "✓ Claude prefs merged from claude/settings.partial.json"
install-tmux:
@echo "Installing tmux and TPM..."
@brew list tmux &>/dev/null || brew install tmux || true
@if [ ! -d ~/.tmux/plugins/tpm ]; then \
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm; \
fi
@echo "Installing tmux plugins..."
@~/.tmux/plugins/tpm/bin/install_plugins || true
@echo "✓ Tmux and plugins installed"
brew-update:
@echo "Updating Homebrew..."
@brew update || true
@echo "Upgrading existing packages..."
@brew upgrade || true
@echo "✓ Homebrew updated"
brew-install-terraform:
@brew tap hashicorp/tap 2>/dev/null || true
@brew list hashicorp/tap/terraform &>/dev/null || brew install hashicorp/tap/terraform || true
@echo "✓ Terraform checked/installed"
# TODO(by 2026-09-01): the alacritty Homebrew cask is deprecated (fails the
# macOS Gatekeeper/notarization check) and will be DISABLED on 2026-09-01,
# after which this install will fail. Before then, switch to building from
# source (cargo install alacritty) or move to a notarized terminal.
brew-install-alacritty:
@brew list --cask alacritty &>/dev/null || brew install --cask alacritty || true
@echo "✓ Alacritty checked/installed"
brew-install-ripgrep-fzf:
@brew list fzf &>/dev/null || brew install fzf || true
@if [ ! -f ~/.fzf.zsh ]; then \
$(HOMEBREW_PREFIX)/opt/fzf/install --all --no-bash --no-fish; \
fi
@brew list ripgrep &>/dev/null || brew install ripgrep || true
@echo "✓ fzf and ripgrep checked/installed"
brew-install-gh:
@brew list gh &>/dev/null || brew install gh || true
@echo "✓ GitHub CLI checked/installed"
brew-install-node:
@brew list node &>/dev/null || brew install node || true
@echo "✓ Node checked/installed"
brew-install-nvim:
@brew list neovim &>/dev/null || brew install neovim || true
@echo "✓ Neovim checked/installed"
brew-install-fonts:
@brew list --cask font-iosevka-nerd-font &>/dev/null || brew install --cask font-iosevka-nerd-font || true
@brew list --cask font-jetbrains-mono-nerd-font &>/dev/null || brew install --cask font-jetbrains-mono-nerd-font || true
@echo "✓ Nerd Fonts checked/installed"
brew-install-raycast:
@brew list --cask raycast &>/dev/null || brew install --cask raycast || true
@echo "✓ Raycast checked/installed"
brew-install-leader-key:
@brew list leader-key &>/dev/null || brew install leader-key || true
@echo "✓ Leader Key checked/installed"
brew-installs: brew-update brew-install-fonts brew-install-terraform brew-install-alacritty brew-install-ripgrep-fzf brew-install-node brew-install-nvim brew-install-gh brew-install-raycast brew-install-leader-key
@echo "✓ Brew packages installed"
install-opencode:
@if [ ! -x ~/.opencode/bin/opencode ]; then \
echo "Installing opencode..."; \
curl -fsSL https://opencode.ai/install | bash; \
fi
@echo "✓ opencode installed"
@echo "⚠️ Run 'opencode auth login' to authenticate"
install-claude-code:
@if ! command -v claude &>/dev/null; then \
echo "Installing Claude Code..."; \
npm install -g @anthropic-ai/claude-code; \
fi
@echo "✓ Claude Code installed"
install-oh-my-zsh:
@if [ ! -d ~/.oh-my-zsh ]; then \
echo "Installing Oh My Zsh..."; \
RUNZSH=no CHSH=no sh -c "$$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"; \
fi
@echo "✓ Oh My Zsh installed"
install-nvim-plugins:
@echo "Neovim plugin installation:"
@echo " [1] Install from lockfile (default, recommended)"
@echo " [2] Update to latest versions"
@read -p "Choose [1/2]: " choice; \
choice=$${choice:-1}; \
if [ "$$choice" = "2" ]; then \
echo "Updating plugins to latest versions..."; \
nvim --headless "+Lazy! update" +qa; \
echo "✓ Neovim plugins updated and lockfile regenerated"; \
else \
echo "Installing from lockfile..."; \
nvim --headless "+Lazy! sync" +qa; \
echo "✓ Neovim plugins installed from lockfile"; \
fi
# Use pipx, not pip: Homebrew's Python is "externally managed" (PEP 668), so
# `pip install` fails with an externally-managed-environment error. pipx puts
# each CLI tool in its own venv and links the executables onto PATH.
install-python-linters:
@echo "Installing Python linters..."
@brew list pipx &>/dev/null || brew install pipx || true
@pipx ensurepath >/dev/null 2>&1 || true
pipx install mypy || true
pipx install flake8 || true
pipx install ruff || true
@echo "✓ Python linters installed"
install-python-lsps:
@brew list pipx &>/dev/null || brew install pipx || true
@pipx ensurepath >/dev/null 2>&1 || true
pipx install python-lsp-server || true
pipx inject python-lsp-server python-lsp-black pyls-flake8 || true
turn-off-macos-dock-bounce:
defaults write com.apple.dock no-bouncing -bool TRUE
killall Dock
enable-key-repeat:
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
defaults write NSGlobalDomain KeyRepeat -int 2
defaults write NSGlobalDomain InitialKeyRepeat -int 15
@echo "✓ Key repeat enabled (restart apps to take effect)"
clean-nvim:
@echo "Cleaning up Neovim data..."
rm -rf ~/.local/share/nvim/site/pack/packer
rm -rf ~/.local/share/nvim/lazy
rm -rf ~/.local/state/nvim
rm -rf ~/.cache/nvim
@echo "✓ Neovim data cleaned"
clean: clean-nvim
@echo "Cleaning up all generated files..."
rm -rf ~/.tmux/plugins
@echo "✓ Cleanup complete"
verify:
@echo "Verifying setup..."
@nvim --version | head -1
@nvim --headless -c 'qa' 2>&1 && echo "✓ Neovim config loads without errors"
@nvim --headless -c 'lua print("lazy.nvim: " .. (pcall(require, "lazy") and "OK" or "FAIL"))' -c 'qa'
@nvim --headless -c 'lua print("telescope: " .. (pcall(require, "telescope") and "OK" or "FAIL"))' -c 'qa'
@nvim --headless -c 'lua print("Navigator: " .. (pcall(require, "Navigator") and "OK" or "FAIL"))' -c 'qa'
@nvim --headless -c 'lua print("mini.files: " .. (pcall(require, "mini.files") and "OK" or "FAIL"))' -c 'qa'
@nvim --headless -c 'lua print("neo-tree: " .. (pcall(require, "neo-tree") and "OK" or "FAIL"))' -c 'qa'
@nvim --headless -c 'lua print("nvim-cmp: " .. (pcall(require, "cmp") and "OK" or "FAIL"))' -c 'qa'
@tmux -V
@test -d ~/.tmux/plugins/vim-tmux-navigator && echo "✓ vim-tmux-navigator: OK" || echo "✗ vim-tmux-navigator: MISSING"
@test -d ~/.tmux/plugins/tmux-resurrect && echo "✓ tmux-resurrect: OK" || echo "✗ tmux-resurrect: MISSING"
@test -d ~/.tmux/plugins/tmux-continuum && echo "✓ tmux-continuum: OK" || echo "✗ tmux-continuum: MISSING"
@echo "✓ Verification complete"