-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
352 lines (286 loc) · 9.33 KB
/
Makefile
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
RED := \033[0;31m
GREEN := \033[0;32m
YELLOW := \033[0;33m
BLUE := \033[0;34m
MAGENTA := \033[0;35m
CYAN := \033[0;36m
WHITE := \033[0;37m
END := \033[0m
INFO := $(BLUE)
WARN := $(YELLOW)
ERROR := $(RED)
MACOS := $(shell uname -s | grep Darwin 2> /dev/null)
log = @echo "$(INFO)$(1)$(END)"
err = @>&2 echo "$(ERROR)$(1)$(END)"
done = $(call log,"Done!")
run = @$(1) || (n=$$?; >&2 echo "$(ERROR)Failed!$(END)"; exit $$n)
### ZDOTDIR
define ZDOTDIR
export ZDOTDIR="$$HOME/.config/zsh"
endef
export ZDOTDIR
~/.zshenv:
ifneq ($(ZDOTDIR), "$$HOME/.config/zsh")
$(call err,"ZDOTDIR misconfigured!")
$(call log,"Configuring ZDOTDIR...")
$(call run,echo "$$ZDOTDIR" | tee -a $@ > /dev/null)
$(call run,echo 'source $$ZDOTDIR/.zshenv' | tee -a $@ > /dev/null)
$(call done)
endif
### mkdirs
~/.%:
$(call log,"Creating dir $@...")
@mkdir -p $@
### laserwave
~/.local/share/laserwave.nvim: | ~/.local/share
$(call err,"laserwave not found!")
$(call log,"Installing laserwave...")
$(call run,git clone [email protected]:lettertwo/laserwave.nvim.git $@)
$(call done)
.PHONY: update-laserwave
update-laserwave: ~/.local/share/laserwave.nvim
$(call log,"Updating laserwave...")
$(call run,cd ~/.local/share/laserwave.nvim && git pull)
$(call done)
~/.config/kitty/laserwave.conf: ~/.local/share/laserwave.nvim ~/.config/kitty
$(call run,ln -sf $</dist/kitty/laserwave.conf $@)
~/.config/alacritty/laserwave.yml: ~/.local/share/laserwave.nvim ~/.config/alacritty
$(call run,ln -sf $</dist/alacritty/laserwave.yml $@)
~/.config/wezterm/colors/laserwave.toml: ~/.local/share/laserwave.nvim ~/.config/wezterm/colors
$(call run,ln -sf $</dist/wezterm/laserwave.toml $@)
~/.config/bat/themes/laserwave.tmTheme: ~/.local/share/laserwave.nvim ~/.config/bat/themes
$(call run,ln -sf $</dist/laserwave.tmTheme $@)
~/.config/git/laserwave.gitconfig: ~/.local/share/laserwave.nvim
$(call run,ln -sf $</dist/delta/laserwave.gitconfig $@)
### homebrew
BREW := $(shell command -v brew 2> /dev/null)
.PHONY: brew
brew:
ifndef BREW
$(call err,"brew not found!")
$(call log,"Installing brew...")
$(call run,curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | /bin/bash /dev/stdin)
$(call done)
endif
.PHONY: update-brew
update-brew: brew
$(call log,"Updating brew bundle...")
$(call run,brew bundle)
$(call log,"Cleaning up...")
$(call run,brew cleanup)
$(call done)
### sheldon
SHELDON := $(shell command -v sheldon 2> /dev/null)
.PHONY: sheldon
sheldon: brew
ifndef SHELDON
$(call err,"sheldon not found!")
$(call log,"Installing sheldon...")
$(call run,brew install sheldon)
$(call done)
endif
.PHONY: update-sheldon
update-sheldon: sheldon
$(call log,"Updating sheldon plugins...")
$(call run,sheldon lock)
$(call done)
### fish
FISH := $(shell command -v fish 2> /dev/null)
.PHONY: fish
fish: brew
ifndef FISH
$(call err,"fish not found!")
$(call log,"Installing fish...")
$(call run,brew install fish fisher)
$(call done)
endif
.PHONY: update-fish
update-fish: fish
$(call log,"Updating fish...")
$(call run,brew upgrade fish fisher)
$(call log,"Updating fisher plugins...")
$(call run,fisher update)
$(call done)
.PHONY: set-fish-as-default
set-fish-as-default: fish
$(call log,"Setting fish as default shell...")
$(call run,echo $$HOMEBREW_PREFIX/bin/fish | sudo tee -a /etc/shells)
$(call run,chsh -s $$HOMEBREW_PREFIX/bin/fish)
$(call done)
### bat
BAT := $(shell command -v bat 2> /dev/null)
.PHONY: bat
bat: brew
ifndef BAT
$(call err,"bat not found!")
$(call log,"Installing bat...")
$(call run,brew install bat)
$(call done)
endif
.PHONY: update-bat
update-bat: bat ~/.config/bat/themes/laserwave.tmTheme
$(call log,"Updating bat...")
$(call run,bat cache --build)
$(call done)
### neovim
NVIM := $(shell command -v nvim 2> /dev/null)
~/.local/share/neovim:
$(call err,"neovim source not found!")
$(call log,"Cloning neovim...")
$(call run,git clone [email protected]:neovim/neovim.git $@)
$(call done)
.PHONY: nvim
nvim: ~/.local/share/neovim
ifndef NVIM
$(call log,"Installing neovim...")
$(call run,cd $< && make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_INSTALL_PREFIX="$$HOME/.local" install)
$(call done)
endif
.PHONY: update-nvim
update-nvim: ~/.local/share/neovim
$(call log,"Updating neovim...")
$(call run,cd $< && git fetch --tags --force && git reset --hard tags/nightly)
$(call run,cd $< && make clean && make distclean && make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_INSTALL_PREFIX="$$HOME/.local" install)
$(call log,"Updating Plugins...")
$(call run,nvim --headless "+Lazy! sync" "+silent w! /dev/stdout" +qa)
$(call log,"Updating Parsers...")
$(call run,nvim --headless "+TSUpdateSync" "+silent w! /dev/stdout" +qa)
$(call log,"Updating Packages...")
$(call run,nvim --headless "+MasonInstallAll" "+silent w! /dev/stdout" +qa)
$(call done)
.PHONY update-nvim-plugins:
update-nvim-plugins: nvim
$(call log,"Updating Plugins...")
$(call run,nvim --headless "+Lazy! sync" "+silent w! /dev/stdout" +qa)
$(call log,"Updating Parsers...")
$(call run,nvim --headless "+TSUpdateSync" "+silent w! /dev/stdout" +qa)
$(call log,"Updating Packages...")
$(call run,nvim --headless "+MasonInstallAll" "+silent w! /dev/stdout" +qa)
$(call done)
### kitty
KITTY := $(shell command -v kitty 2> /dev/null)
.PHONY: kitty
kitty: ~/.config/kitty/laserwave.conf
ifndef KITTY
$(call err,"kitty not found!")
$(call log,"Installing kitty...")
else
$(call log,"Updating kitty...")
endif
$(call run,curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin installer=nightly launch=n)
ifdef MACOS
$(call run,ln -sf /Applications/kitty.app/Contents/MacOS/kitty "$$HOME/.local/bin/kitty")
$(call run,rm /var/folders/*/*/*/com.apple.dock.iconcache; killall Dock) #force refresh of dock icons.
endif
$(call done)
.PHONY: update-kitty
update-kitty: kitty
.PHONY: update-dock-icons
update-dock-icons:
ifdef MACOS
$(call run,rm /var/folders/*/*/*/com.apple.dock.iconcache; killall Dock) #force refresh of dock icons.
$(call done)
else
$(call err,"Not on macOS!")
endif
### wezterm
WEZTERM := $(shell command -v wezterm 2> /dev/null)
.PHONY: wezterm
wezterm: brew ~/.config/wezterm/colors/laserwave.toml
ifndef WEZTERM
$(call err,"wezterm not found!")
$(call log,"Installing wezterm...")
else
$(call log,"Updating wezterm...")
endif
$(call run,brew install wezterm)
$(call done)
.PHONY: update-wezterm
update-wezterm: wezterm
### qmk
~/Library/Application\ Support/qmk/qmk.ini:
ifdef MACOS
$(call err,"qmk config not found!")
$(call log,"Linking qmk config...")
$(call run,mkdir -p ~/Library/Application\ Support/qmk/)
$(call run,ln -sf "$$HOME/.config/qmk/qmk.ini" "$@")
$(call done)
endif
~/.local/share/qmk_firmware: ~/Library/Application\ Support/qmk/qmk.ini
$(call err,"qmk_firmware not found!")
$(call log,"Cloning qmk_firmware...")
$(call run,qmk setup lettertwo/qmk_firmware --branch lettertwo)
$(call done)
.PHONY: qmk
qmk: ~/Library/Application\ Support/qmk/qmk.ini ~/.local/share/qmk_firmware
.PHONY: update-qmk
update-qmk: qmk
$(call log,"Updating qmk_firmware...")
$(call run,qmk setup lettertwo/qmk_firmware)
$(call done)
### rust
RUSTC := $(shell command -v rustc 2> /dev/null)
~/.cargo/bin/rustup:
$(call err,"rustup not found!")
$(call log,"Installing rustup...")
$(call run,curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh)
$(call done)
~/.cargo/bin/cargo-binstall:
$(call err,"cargo-binstall not found!")
$(call log,"Installing cargo-binstall...")
$(call run,curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | sh)
$(call done)
~/.cargo/bin/cargo-nextest:
$(call err,"cargo-nextest not found!")
$(call log,"Installing cargo-nextest...")
$(call run,cargo binstall cargo-nextest --secure --no-confirm)
$(call done)
~/.cargo/bin/cargo-watch:
$(call err,"cargo-watch not found!")
$(call log,"Installing cargo-watch...")
$(call run,cargo binstall cargo-watch --secure --no-confirm)
$(call done)
.PHONY: rust
rust: ~/.cargo/bin/rustup ~/.cargo/bin/cargo-binstall ~/.cargo/bin/cargo-nextest ~/.cargo/bin/cargo-watch
ifndef RUSTC
$(call err,"rustc not found!")
$(call log,"Installing rust stable...")
$(call run,rustup toolchain install stable)
$(call log,"Setting default toolchain to stable...")
$(call run,rustup default stable)
$(call log,"Installing rust nightly...")
$(call run,rustup toolchain install nightly)
$(call done)
endif
### config
.PHONY: update-config
update-config:
$(call log,"Updating config...")
$(call run,git pull)
$(call done)
.PHONY: mkdirs
mkdirs: ~/.cache/zsh ~/.local/bin ~/.local/share ~/.local/state/zsh/completions
.PHONY: install
install: mkdirs ~/.zshenv ~/.local/share/laserwave.nvim brew set-fish-as-default
@echo ""
$(call done)
@echo ""
@echo "Restart your shell and run $(BLUE)make update$(END) to fetch the latest stuff."
ifdef MACOS
@echo ""
@echo "Other useful things to install:"
@echo " 1password: $(CYAN)https://1password.com/downloads/mac/$(END)"
@echo " raycast: $(CYAN)https://www.raycast.com/$(END)"
@echo " rectangle: $(CYAN)https://rectangleapp.com/pro$(END)"
@echo " MonoLisa: $(CYAN)https://www.monolisa.dev/orders$(END)"
@echo " NerdFonts (Symbols Only): $(CYAN)https://github.com/ryanoasis/nerd-fonts/releases/$(END)"
endif
.PHONY: update
update: update-config \
update-laserwave \
update-brew \
update-fish \
update-bat \
update-nvim \
update-kitty \
update-wezterm