-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
665 lines (608 loc) · 25.3 KB
/
Makefile
File metadata and controls
665 lines (608 loc) · 25.3 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
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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# Makefile for dotfiles installation and configuration
# Usage: make <target>
SHELL := /bin/bash
.SHELLFLAGS := -ec
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
NOSUDO ?=
DOTFILES := $(PWD)
OSTYPE := $(shell uname -s)
ARCHITECTURE := $(shell uname -m)
DEVNUL := /dev/null
WHICH := which
PATH := $(PATH):/usr/local/bin:/usr/local/sbin:/usr/bin
PATH := $(PATH):$(DOTFILES)/bin/$(OSTYPE)/$(ARCHITECTURE):$(DOTFILES)/bin/$(OSTYPE)
PATH := $(PATH):$(HOME)/bin:$(HOME)/.local/bin:$(HOME)/.local/nodejs/bin
ASAHI_DMS_PLUGINS ?= calculator webSearch
NEXTCLOUD_DIR ?= $(HOME)/Nextcloud/portal
# Validation targets
.PHONY: validate-macos validate-linux validate-tools
validate-macos: ## Validate macOS environment
@if [ "$(OSTYPE)" != "Darwin" ]; then echo "Error: This target requires macOS" && exit 1; fi
validate-linux: ## Validate Linux environment
@if [ "$(OSTYPE)" = "Darwin" ]; then echo "Error: This target requires Linux" && exit 1; fi
validate-tools: ## Validate that minimal required tools are available
@$(call print_step,Validating required tools)
@command -v curl >/dev/null 2>&1 || { $(call print_error,curl is required); exit 1; }
@command -v git >/dev/null 2>&1 || { $(call print_error,git is required); exit 1; }
@command -v make >/dev/null 2>&1 || { $(call print_error,make is required); exit 1; }
@$(call print_step,All required tools are available)
# Common functions
define create_symlink
@if [ -e "$(1)" ] || [ -L "$(1)" ]; then \
echo "Linking $(1) -> $(2)"; \
ln -sfv $(1) $(2); \
else \
echo "\033[1m\033[33mWarning: Source $(1) does not exist, skipping symlink\033[0m"; \
fi
endef
define replace_with_symlink
@mkdir -p "$$(dirname "$(2)")"
@if [ -L "$(2)" ] && [ "$$(readlink -f "$(2)")" = "$$(readlink -f "$(1)")" ]; then \
echo "Link already correct: $(2) -> $(1)"; \
else \
if [ -e "$(2)" ] || [ -L "$(2)" ]; then \
echo "Removing existing $(2)"; \
rm -rf "$(2)"; \
fi; \
echo "Linking $(2) -> $(1)"; \
ln -sfn "$(1)" "$(2)"; \
fi
endef
define link_if_exists
@mkdir -p "$$(dirname "$(2)")"
@if [ -e "$(1)" ] || [ -L "$(1)" ]; then \
echo "Linking $(2) -> $(1)"; \
ln -sfn "$(1)" "$(2)"; \
else \
$(call print_warning,Optional source $(1) does not exist, skipping symlink); \
fi
endef
define link_first_exists
@mkdir -p "$$(dirname "$(2)")"
@linked=0; \
for source in $(1); do \
if [ -e "$$source" ] || [ -L "$$source" ]; then \
echo "Linking $(2) -> $$source"; \
ln -sfn "$$source" "$(2)"; \
linked=1; \
break; \
fi; \
done; \
if [ "$$linked" -eq 0 ]; then \
$(call print_warning,Optional sources not found for $(2): $(1)); \
fi
endef
define print_step
echo -e "\033[1m\033[34m==> $(1)\033[0m"
endef
define print_error
echo -e "\033[1m\033[31mError: $(1)\033[0m" >&2
endef
define print_warning
echo -e "\033[1m\033[33mWarning: $(1)\033[0m"
endef
# and homebrew available
ifeq ($(ARCHITECTURE), arm64)
PATH := $(PATH):/opt/homebrew/bin:/opt/homebrew/sbin
endif
CONTAINER_CMD := $(shell if command -v podman >/dev/null 2>&1; then echo "podman"; elif command -v docker >/dev/null 2>&1; then echo "docker"; else echo "container"; fi)
ifeq ($(CONTAINER_CMD), docker)
CONTAINER_BUILD_CMD := build --platform linux/amd64 --progress plain --rm
else ifeq ($(CONTAINER_CMD), container)
CONTAINER_BUILD_CMD := build --progress plain --arch $(ARCHITECTURE)
else
CONTAINER_BUILD_CMD := build --progress plain --rm
endif
.DEFAULT_GOAL := help
.PHONY: macos
macos: ## Complete macOS setup with all components
macos: validate-macos validate-tools sudo directories homebrew _macos zsh python misc nvim _git node
@$(call print_step,Finalizing macOS setup)
$(call print_step,Switching to Zsh); \
$(SHELL) $(DOTFILES)/autoloaded/switch_zsh; \
zsh -i -c "fast-theme free" 2>/dev/null || $(call print_warning,Failed to set fast-theme); \
compaudit 2>/dev/null | xargs chmod g-w 2>/dev/null || true
.PHONY: linux
linux: ## Complete Linux setup with all components
linux: validate-linux validate-tools sudo directories _linux _git zsh python misc node nvim
@$(call print_step,Finalizing Linux setup)
$(SHELL) $(DOTFILES)/autoloaded/switch_zsh
.PHONY: minimal
minimal: ## Minimal Linux setup without sudo requirements
minimal: validate-linux validate-tools directories _linux _git zsh python misc node nvim
.PHONY: help
help: ## Show this help message
@echo "#######################################################################"
@echo "# Dotfiles Installation"
@echo "#######################################################################"
@grep -E '^[a-zA-Z0-9_-]+:.*## ' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-15s\033[0m %s\n", $$1, $$2}'
@echo "#######################################################################"
.PHONY: sudo
sudo: ## Authenticate and keep sudo session alive
$(call print_step,Installation with sudo required)
@if sudo -n true 2>/dev/null; then \
$(call print_warning,sudo session already active); \
else \
sudo -v; \
fi
@while true; do sudo -n true; sleep 1200; kill -0 "$$$$" || exit; done 2>/dev/null &
.PHONY: homebrew
homebrew: ## Install Homebrew and bundle packages
homebrew: | sudo
$(call print_step,Installing brew if not already present)
ifeq ($(ARCHITECTURE), arm64)
$(call print_step,Installing rosetta for non-native apps)
@if [ ! -d "/usr/libexec/rosetta" ]; then softwareupdate --install-rosetta --agree-to-license; fi
endif
ifeq ($(shell ${WHICH} brew 2>${DEVNUL}),)
@$(SHELL) -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
$(call print_warning,Homebrew is already installed)
endif
$(call print_step,Installing brew formulas)
@brew bundle --file="$(DOTFILES)/Brewfile" --no-lock
@brew cleanup
-brew doctor
.PHONY: python
python: ## Install Python tools and configure IPython
$(call print_step,Installing python tools)
ifeq ($(OSTYPE), Linux)
@if ! command -v uv >/dev/null 2>&1; then \
$(call print_step,Installing uv package manager); \
curl -LsSf https://astral.sh/uv/install.sh | sh; \
else \
$(call print_warning,uv is already installed); \
fi
endif
@if command -v uv >/dev/null 2>&1; then \
uv tool install --upgrade ty@latest; \
uv tool install --upgrade ipython --with matplotlib --with numpy; \
else \
$(call print_error,uv not available for Python tool installation); \
fi
@if command -v ipython >/dev/null 2>&1; then \
mkdir -p $(HOME)/.ipython/profile_default; \
ln -sfv $(DOTFILES)/python/ipython_config.py $(HOME)/.ipython/profile_default/; \
else \
$(call print_warning,IPython not available for configuration); \
fi
.PHONY: misc
misc: ## Install miscellaneous tools and configurations
$(call print_step,Installing misc)
@if ! command -v fzf >/dev/null 2>&1; then \
if [ -d "$(HOME)/.fzf/.git" ]; then \
$(call print_step,Updating existing fzf checkout); \
git -C "$(HOME)/.fzf" pull --ff-only; \
"$(HOME)/.fzf/install" --bin; \
elif [ -e "$(HOME)/.fzf" ]; then \
$(call print_warning,$(HOME)/.fzf already exists but is not a git checkout; skipping fzf clone); \
else \
$(call print_step,Installing fzf); \
git clone --depth 1 https://github.com/junegunn/fzf.git "$(HOME)/.fzf"; \
"$(HOME)/.fzf/install" --bin; \
fi; \
else \
$(call print_warning,fzf is already installed); \
fi
$(call create_symlink,$(DOTFILES)/wgetrc,$(HOME)/.wgetrc)
$(call create_symlink,$(DOTFILES)/curlrc,$(HOME)/.curlrc)
$(call create_symlink,$(DOTFILES)/tmux/tmux.conf,$(HOME)/.tmux.conf)
$(call create_symlink,$(DOTFILES)/latexmkrc,$(HOME)/.latexmkrc)
$(call create_symlink,$(DOTFILES)/btop,$(HOME)/.config/btop)
.PHONY: zsh
zsh: ## Install and configure Zsh with completions
zsh: | directories
$(call print_step,Installing zsh and tools)
@if ! command -v zsh >/dev/null 2>&1; then \
$(call print_error,Zsh is not installed. Please install it first); \
exit 1; \
fi
$(call create_symlink,$(DOTFILES)/zsh/zshrc,$(HOME)/.zshrc)
$(call create_symlink,$(DOTFILES)/zsh/zlogin,$(HOME)/.zlogin)
$(call create_symlink,$(DOTFILES)/zsh/zshenv,$(HOME)/.zshenv)
$(call create_symlink,$(DOTFILES)/zsh/zprofile,$(HOME)/.zprofile)
@mkdir -p $(HOME)/.zsh/completion
@if command -v rg >/dev/null 2>&1; then \
$(call print_step,Generating ripgrep completions); \
rg --generate complete-zsh > $(HOME)/.zsh/completion/_rg; \
fi
@if [ -f "$(HOME)/.zshrc" ]; then \
$(call print_step,Checking zshrc); \
zsh -n $(HOME)/.zshrc || $(call print_warning,zshrc syntax check failed); \
fi
.PHONY: node
node: ## Install Node.js and global npm packages
$(call print_step,Installing node and npm packages)
@if ! command -v node >/dev/null 2>&1; then \
$(call print_step,Installing Node.js); \
bash $(DOTFILES)/scripts/nodejs.sh; \
else \
$(call print_warning,Node.js is already installed); \
fi
@if command -v npm >/dev/null 2>&1; then \
$(call print_step,Installing global npm packages); \
npm i --location=global npm@latest; \
npm i --location=global eslint; \
npm i --location=global neovim; \
else \
$(call print_error,npm not available for package installation); \
fi
.PHONY: nvim
nvim: ## Install and configure Neovim with plugins
nvim: | directories
$(call print_step,Installing nvim dependencies)
@if ! command -v nvim >/dev/null 2>&1; then \
$(call print_error,Neovim is not installed. Please install it first); \
exit 1; \
fi
nvim "+call mkdir(stdpath('config'), 'p')" +qall; \
rm -rfv $(HOME)/.config/nvim; \
touch $(HOME)/.localnvim.lua; \
ln -sfv $(DOTFILES)/nvim $(HOME)/.config; \
$(call print_step,Syncing Neovim plugins); \
nvim --headless "+lua vim.pack.update()" "+qa"
.PHONY: _git
_git: ## Configure Git with completion and dotfiles
$(call print_step,Installing stuff for git)
@if ! [ -f "$(HOME)/.git-completion.bash" ]; then \
$(call print_step,Downloading git completion); \
curl -fsSL https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o $(HOME)/.git-completion.bash; \
else \
$(call print_warning,Git completion already exists); \
fi
@if [ -f "$(DOTFILES)/git/gitconfig" ]; then ln -sfv $(DOTFILES)/git/gitconfig $(HOME)/.gitconfig; fi
@if [ -f "$(DOTFILES)/git/gitignore" ]; then ln -sfv $(DOTFILES)/git/gitignore $(HOME)/.gitignore; fi
.PHONY: agents
agents: ## Sync coding agent instructions and settings from Nextcloud
# Codex
$(call print_step,Syncing Codex agent configuration)
@mkdir -p $(HOME)/.codex
$(call link_if_exists,$(NEXTCLOUD_DIR)/AGENTS.md,$(HOME)/.codex/AGENTS.md)
$(call link_first_exists,$(NEXTCLOUD_DIR)/codex_config.toml $(NEXTCLOUD_DIR)/codex_settings.toml,$(HOME)/.codex/config.toml)
# Claude
ifneq ($(shell command -v claude 2>/dev/null),)
$(call print_step,Syncing Claude agent configuration)
@mkdir -p $(HOME)/.claude
$(call link_if_exists,$(NEXTCLOUD_DIR)/AGENTS.md,$(HOME)/.claude/CLAUDE.md)
$(call link_if_exists,$(NEXTCLOUD_DIR)/claude_settings.json,$(HOME)/.claude/settings.json)
else
$(call print_warning,Claude CLI not installed; skipping Claude agent configuration)
endif
# Gemini
ifneq ($(shell command -v gemini 2>/dev/null),)
$(call print_step,Syncing Gemini agent configuration)
@mkdir -p $(HOME)/.gemini
$(call link_if_exists,$(NEXTCLOUD_DIR)/AGENTS.md,$(HOME)/.gemini/GEMINI.md)
$(call link_if_exists,$(NEXTCLOUD_DIR)/gemini_settings.json,$(HOME)/.gemini/settings.json)
else
$(call print_warning,Gemini CLI not installed; skipping Gemini agent configuration)
endif
# OpenCode
$(call print_step,Syncing OpenCode agent configuration)
$(call link_if_exists,$(NEXTCLOUD_DIR)/opencode.jsonc,$(HOME)/.config/opencode/opencode.jsonc)
.PHONY: after
after: ## Post-installation setup and service start
after: _terminal
$(call print_step,Post-installation setup)
$(call print_step,Running git setup)
@bash $(DOTFILES)/git/setup.sh
@if [ "$(OSTYPE)" = "Linux" ] && [ -f "$(DOTFILES)/linux/apt.sh" ] && command -v apt-get >/dev/null 2>&1; then \
$(call print_step,Installing Linux desktop packages); \
bash $(DOTFILES)/linux/apt.sh "desktop"; \
fi
@if command -v nvim >/dev/null 2>&1 ; then \
$(call print_step,Updating Treesitter parsers); \
nvim -i NONE -u $(DOTFILES)/nvim/init.lua -c "TSUpdate" -c "quitall"; \
fi
ifeq ($(OSTYPE), Darwin)
@if command -v yabai >/dev/null 2>&1; then \
$(call print_step,Starting yabai and skhd service); \
echo "$$(whoami) ALL=(root) NOPASSWD: sha256:$$(shasum -a 256 $$(which yabai) | cut -d ' ' -f 1) $$(which yabai) --load-sa" | sudo tee /private/etc/sudoers.d/yabai; \
sudo yabai --install-sa; \
yabai --start-service; \
skhd --start-service; \
fi
@if command -v brew >/dev/null 2>&1; then \
$(call print_step,Starting sketchybar service); \
brew services start sketchybar; \
fi
@$(MAKE) agents
endif
.PHONY: directories
directories: ## Create necessary directories
$(call print_step,Creating directories)
@mkdir -p $(HOME)/config
@mkdir -p $(HOME)/.zsh
@mkdir -p $(HOME)/.config/htop
@mkdir -p $(HOME)/tmp
@mkdir -p $(HOME)/.Trash
@mkdir -p $(HOME)/Downloads
@mkdir -p $(HOME)/bin
@mkdir -p $(HOME)/.zcompcache
.PHONY: micro
micro: ## Minimal setup with bash configuration
micro: _backup _bash
$(call print_step,Setting up micro configuration)
$(call create_symlink,$(DOTFILES)/bash/tmux.conf,$(HOME)/.tmux.conf)
$(call create_symlink,$(DOTFILES)/bash/vimrc,$(HOME)/.vimrc)
$(call create_symlink,$(DOTFILES)/htop/server,$(HOME)/.htoprc)
@mkdir -p $(HOME)/.Trash
.PHONY: _bash
_bash: ## Configure bash dotfiles
$(call print_step,Configuring bash dotfiles)
$(call create_symlink,$(DOTFILES)/bash/bash_profile,$(HOME)/.bash_profile)
$(call create_symlink,$(DOTFILES)/bash/bashrc,$(HOME)/.bashrc)
$(call create_symlink,$(DOTFILES)/bash/bash_prompt,$(HOME)/.bash_prompt)
$(call create_symlink,$(DOTFILES)/bash/bash_logout,$(HOME)/.bash_logout)
$(call create_symlink,$(DOTFILES)/bash/bash_aliases,$(HOME)/.bash_aliases)
$(call create_symlink,$(DOTFILES)/bash/bash_functions,$(HOME)/.bash_functions)
.PHONY: _backup
_backup: ## Backup existing dotfiles
$(call print_step,Backing up existing dotfiles)
@mkdir -p $(HOME)/old_dots
@for file in .bash* .profile .vimrc .tmux.conf .htoprc; do \
if [ -e "$(HOME)/$$file" ]; then \
echo "Backing up $$file"; \
mv "$(HOME)/$$file" "$(HOME)/old_dots/" 2>/dev/null || true; \
fi; \
done
.PHONY: _linux
_linux: ## Linux-specific setup and package installation
$(call print_step,Installing linux basis)
@mkdir -p $(HOME)/bin $(HOME)/.local/bin $(HOME)/Uploads
@if [ -z "$(NOSUDO)" ] ; then \
$(call print_step,Installing Linux packages); \
bash $(DOTFILES)/linux/apt.sh "default"; \
fi
@mkdir -p $(HOME)/.config/htop; \
@ln -sfv $(DOTFILES)/htop/server $(HOME)/.config/htop/htoprc; \
@if ! command -v nvim >/dev/null 2>&1; then \
if [ -z "$(NOSUDO)" ]; then \
bash $(DOTFILES)/scripts/nvim.sh "source"; \
else \
bash $(DOTFILES)/scripts/nvim.sh "binary"; \
fi; \
fi
@if ! command -v tree-sitter >/dev/null 2>&1 ; then \
$(call print_step,Installing tree-sitter); \
bash $(DOTFILES)/scripts/tree-sitter.sh; \
fi
.PHONY: _macos
_macos: ## macOS-specific configuration and applications
$(call print_step,Configure macos and applications)
@if ! xcode-select -p >/dev/null 2>&1; then \
$(call print_step,Installing Xcode command line tools); \
sudo xcode-select --install; \
sudo xcodebuild -license accept; \
else \
$(call print_warning,Xcode command line tools already installed); \
fi
@mkdir -p $(HOME)/screens $(HOME)/.config $(HOME)/Library/Fonts
$(call print_step,Running macOS setup script)
@bash $(DOTFILES)/macos/main.bash
@ln -sfv $(DOTFILES)/sketchybar/bottom $(HOME)/.config/sketchybar
@ln -sfv $(DOTFILES)/sketchybar/top $(HOME)/.config/sketchybar-top
$(MAKE) sketchybar-top
$(call print_step,Downloading sketchybar font)
@bash $(DOTFILES)/scripts/sketchybar_app_font.sh
@ln -sfv $(DOTFILES)/skhd $(HOME)/.config/skhd
$(call print_step,Running Sioyek setup)
@zsh $(DOTFILES)/scripts/sioyek.sh
@ln -sfv $(DOTFILES)/sioyek $(HOME)/.config/sioyek
@if command -v swift >/dev/null 2>&1; then \
mkdir -p $(HOME)/.zsh/completion; \
swift package completion-tool generate-zsh-script > $(HOME)/.zsh/completion/_swift 2>/dev/null || true; \
fi
@if ! command -v sourcekit-lsp >/dev/null 2>&1 ; then \
$(call print_step,Installing sourcekit-lsp); \
bash $(DOTFILES)/scripts/sourcekit-lsp.sh; \
fi
@if ! command -v battery >/dev/null 2>&1; then \
$(call print_step,Installing battery manager); \
curl -fsSL https://raw.githubusercontent.com/actuallymentor/battery/main/setup.sh | bash; \
battery maintain 80; \
fi
@ln -sfv $(DOTFILES)/mpv $(HOME)/.config/mpv
@ln -sfv $(DOTFILES)/yabai $(HOME)/.config/yabai
.PHONY: _terminal
_terminal: ## Install and configure terminal emulator
@if ! command -v ghostty >/dev/null 2>&1; then \
$(call print_warning,Ghostty not installed); \
else \
$(call print_step,Ghostty is available); \
fi
@ln -sfv $(DOTFILES)/ghostty $(HOME)/.config/ghostty; \
mkdir -p $(HOME)/.config/htop; \
ln -sfv $(DOTFILES)/htop/personal $(HOME)/.config/htop/htoprc; \
.PHONY: asahi asahi-system asahi-zotero asahi-require-danklinux asahi-common
.PHONY: asahi-danklinux asahi-dms-plugins
.PHONY: asahi-shell asahi-battery-alerts asahi-default-shell check-asahi
asahi: ## Asahi Linux (Fedora Minimal): apply DankLinux Hyprland and Ghostty config
asahi: validate-linux validate-tools sudo asahi-system asahi-zotero asahi-require-danklinux
asahi: asahi-danklinux asahi-battery-alerts asahi-default-shell check-asahi
@$(MAKE) agents
@if [ -d "$(HOME)/Pictures/wallpaper/.git" ]; then \
$(call print_step,Updating wallpapers); \
git -C "$(HOME)/Pictures/wallpaper" pull --ff-only || $(call print_warning,Failed to update wallpapers); \
elif [ -e "$(HOME)/Pictures/wallpaper" ]; then \
$(call print_warning,$(HOME)/Pictures/wallpaper already exists and is not a git checkout; skipping wallpaper clone); \
else \
$(call print_step,Downloading wallpapers); \
mkdir -p "$(HOME)/Pictures"; \
git clone https://github.com/mylinuxforwork/wallpaper.git "$(HOME)/Pictures/wallpaper"; \
fi
asahi-system: ## Update Fedora and install base packages for Asahi
@bash $(DOTFILES)/asahi/dnf.sh
@light -s sysfs/leds/kbd_backlight -S 30
asahi-zotero: ## Install Zotero ARM64 on Asahi Linux
@if [ -x "/opt/zotero/zotero" ]; then \
$(call print_warning,Zotero already installed at /opt/zotero; skipping setup script); \
else \
$(call print_step,Installing Zotero ARM64); \
bash $(DOTFILES)/scripts/setup_zotero.sh; \
fi
asahi-require-danklinux: ## Verify DankLinux is already installed
@if ! command -v dms >/dev/null 2>&1; then \
$(call print_error,DankLinux is not installed. Install DankLinux first, then rerun make asahi); \
exit 1; \
fi
asahi-common: directories _git zsh python misc nvim
@mkdir -p $(HOME)/.config/environment.d
@mkdir -p $(HOME)/.local/share/applications
@ln -sfv $(DOTFILES)/asahi/mimeapps.list $(HOME)/.config/mimeapps.list
@$(call print_step,Fixing Linux desktop icons); \
bash $(DOTFILES)/scripts/fix_linux_desktop_icons.sh
@if ! command -v tree-sitter >/dev/null 2>&1; then \
$(call print_step,Installing tree-sitter CLI); \
bash $(DOTFILES)/scripts/tree-sitter.sh; \
fi
asahi-danklinux: ## Apply DankLinux Hyprland user config
asahi-danklinux: asahi-common
@mkdir -p $(HOME)/.cache/DankMaterialShell
@mkdir -p $(HOME)/screenshots
$(call replace_with_symlink,$(DOTFILES)/asahi/hypr,$(HOME)/.config/hypr)
$(call replace_with_symlink,$(DOTFILES)/asahi/dms,$(HOME)/.config/DankMaterialShell)
$(call replace_with_symlink,$(DOTFILES)/asahi/ghostty,$(HOME)/.config/ghostty)
$(call replace_with_symlink,$(DOTFILES)/asahi/matugen,$(HOME)/.config/matugen)
@mkdir -p $(HOME)/.config/mpv
@ln -sfv $(DOTFILES)/mpv/mpv_asahi.conf $(HOME)/.config/mpv/mpv.conf
@ln -sfv $(DOTFILES)/asahi/environment.d/90-dms.conf $(HOME)/.config/environment.d/90-dms.conf
@$(MAKE) asahi-dms-plugins
@mkdir -p $(HOME)/.config/librewolf/librewolf
@ln -sfv $(DOTFILES)/asahi/librewolf/librewolf.overrides.cfg $(HOME)/.config/librewolf/librewolf/librewolf.overrides.cfg
@if [ -d "$(HOME)/.config/librewolf/librewolf" ]; then \
profiles_linked=0; \
for profile_dir in "$(HOME)"/.config/librewolf/librewolf/*.default*; do \
if [ -d "$$profile_dir" ]; then \
mkdir -p "$$profile_dir/chrome"; \
ln -sfv "$(DOTFILES)/asahi/librewolf/userChrome.css" "$$profile_dir/chrome/userChrome.css"; \
ln -sfv "$(HOME)/.config/DankMaterialShell/librewolf.css" "$$profile_dir/chrome/librewolf.css"; \
profiles_linked=1; \
fi; \
done; \
if [ "$$profiles_linked" -eq 0 ]; then \
$(call print_warning,LibreWolf profile not found yet; skipping userChrome.css link); \
fi; \
fi
@$(MAKE) asahi-shell
asahi-dms-plugins: ## Install DMS plugins declared by ASAHI_DMS_PLUGINS
@if command -v dms >/dev/null 2>&1; then \
for plugin in $(ASAHI_DMS_PLUGINS); do \
if [ -d "$(HOME)/.config/DankMaterialShell/plugins/$$plugin" ]; then \
$(call print_step,DMS plugin $$plugin already installed); \
else \
$(call print_step,Installing DMS plugin $$plugin); \
dms plugins install "$$plugin" || $(call print_warning,Failed to install DMS plugin $$plugin); \
fi; \
done; \
else \
$(call print_warning,dms not installed; skipping DMS plugins); \
fi
asahi-shell: ## Generate optional shell integrations for DMS and dgop
@mkdir -p $(HOME)/.zsh/completion
@if command -v dms >/dev/null 2>&1; then \
$(call print_step,Generating DMS zsh completions); \
dms completion zsh > $(HOME)/.zsh/completion/_dms; \
else \
$(call print_warning,dms not installed; skipping DMS completions); \
fi
@if command -v dgop >/dev/null 2>&1; then \
$(call print_step,Generating dgop zsh completions); \
dgop completion zsh | sed -e '1s/.*/#compdef dgop dankgop/' -e '2s/.*/compdef _dankgop dgop dankgop/' > $(HOME)/.zsh/completion/_dgop; \
else \
$(call print_warning,dgop not installed; skipping dgop completions); \
fi
asahi-battery-alerts: ## Install and start Asahi battery alert daemon
@$(call print_step,Installing Asahi battery alerts)
@DOTFILES="$(DOTFILES)" bash $(DOTFILES)/scripts/asahi-battery-alerts.sh
asahi-default-shell: ## Make Zsh the default login shell for Asahi
@$(SHELL) $(DOTFILES)/autoloaded/switch_zsh
.PHONY: check
check: ## Run Neovim health check
@if command -v nvim >/dev/null 2>&1; then \
$(call print_step,Running Neovim health check); \
nvim -i NONE -c "checkhealth"; \
else \
$(call print_error,Neovim is not installed); \
exit 1; \
fi
check-asahi: ## Run optional DankLinux checks for the Asahi setup
@if command -v dms >/dev/null 2>&1 && [ -d "$(HOME)/.config/DankMaterialShell" ]; then \
$(call print_step,Running DMS doctor); \
dms --config "$(HOME)/.config/DankMaterialShell" doctor -v; \
else \
$(call print_warning,DMS config not available; skipping dms doctor); \
fi
.PHONY: benchmark
benchmark: ## Benchmark Neovim and Zsh startup times
@if command -v nvim >/dev/null 2>&1; then \
$(call print_step,nvim startuptime clean); \
nvim --startuptime /tmp/startup-clean.log --clean "+qall" && \
echo "Clean startup:" && \
tail -2 /tmp/startup-clean.log && \
rm -f /tmp/startup-clean.log; \
$(call print_step,nvim startuptime with all plugins); \
nvim --startuptime /tmp/startup-full.log "+qall" && \
echo "Full startup:" && \
tail -2 /tmp/startup-full.log && \
rm -f /tmp/startup-full.log; \
else \
$(call print_warning,Neovim not available for benchmarking); \
fi
@if command -v zsh >/dev/null 2>&1 ; then \
$(call print_step,zsh startuptime); \
zsh $(DOTFILES)/autoloaded/bench_zsh; \
else \
$(call print_warning,Zsh benchmark script not available); \
fi
.PHONY: format
format: ## Format Lua files with stylua
@if command -v stylua >/dev/null 2>&1; then \
$(call print_step,Formatting Lua files with stylua); \
stylua -v -f $(DOTFILES)/.stylua.toml $$(find $(DOTFILES) -type f -name '*.lua' ! -name 'colors.lua' 2>/dev/null) || true; \
else \
$(call print_warning,stylua not installed); \
fi
.PHONY: uninstall
uninstall: ## Remove installed dotfiles and configurations
-@rm -f $(HOME)/.zshrc
-@rm -f $(HOME)/.zshenv
-@rm -f $(HOME)/.zprofile
-@rm -f $(HOME)/.tmux.conf
-@rm -f $(HOME)/.wgetrc
-@rm -f $(HOME)/.curlrc
-@rm -f $(HOME)/.latexmkrc
-@rm -f $(HOME)/.gitignore
-@rm -f $(HOME)/.gitconfig
-@rm -rf $(HOME)/.config/htop
-@rm -rf $(HOME)/.config/btop
-@rm -rf $(HOME)/.config/nvim
ifeq ($(OSTYPE), Darwin)
-@rm -rf $(HOME)/.config/skhd
-@rm -rf $(HOME)/.config/sketchybar
-@rm -rf $(HOME)/.config/sioyek
-@rm -rf $(HOME)/.config/yabai
-@sudo battery uninstall 2>/dev/null || true
endif
.PHONY: test
test: ## Test installation in Docker container
$(call print_step,Testing linux installation on ${OSTYPE})
ifeq ($(NOSUDO), 1)
$(CONTAINER_CMD) $(CONTAINER_BUILD_CMD) -t dotfiles ${PWD} -f $(DOTFILES)/docker/Dockerfile;
$(CONTAINER_CMD) run -it --rm --name maketest -d dotfiles:latest;
$(CONTAINER_CMD) exec -it maketest /bin/bash -c "make NOSUDO=$(NOSUDO) minimal";
else
$(CONTAINER_CMD) $(CONTAINER_BUILD_CMD) -t dotfiles_sudo ${PWD} -f $(DOTFILES)/docker/sudoer.Dockerfile;
$(CONTAINER_CMD) run -it --rm --name maketest_sudo -d dotfiles_sudo:latest;
$(CONTAINER_CMD) exec -it maketest_sudo /bin/bash -c "make linux";
endif
$(call print_step,Container can now be shut down)
.PHONY: sketchybar-top
sketchybar-top: ## Install and start SketchyBar Top LaunchAgent
$(call print_step,Installing sketchybar-top LaunchAgent)
@mkdir -p $(HOME)/Library/LaunchAgents
@ln -sfv $(DOTFILES)/sketchybar/top/git.frank.sketchybar-top.plist $(HOME)/Library/LaunchAgents/git.frank.sketchybar-top.plist
@launchctl bootout gui/$(shell id -u) $(HOME)/Library/LaunchAgents/git.frank.sketchybar-top.plist 2>/dev/null || true
@launchctl bootstrap gui/$(shell id -u) $(HOME)/Library/LaunchAgents/git.frank.sketchybar-top.plist