-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
203 lines (176 loc) Β· 7.23 KB
/
Makefile
File metadata and controls
203 lines (176 loc) Β· 7.23 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
# Nix Dotfiles Makefile (macOS + Linux)
# Usage: make bootstrap-personal (or bootstrap-work, bootstrap-linux)
# Configuration names
PERSONAL_CONFIG = personal
WORK_CONFIG = work
LINUX_CONFIG = srizzling@BlueShell
test-flake: ## Check Nix flake evaluation
@echo "π Checking Nix flake..."
nix flake check --no-build
# Default target
.PHONY: help
help:
@echo "Nix Darwin Dotfiles Management (Apple Silicon)"
@echo ""
@echo "Bootstrap commands:"
@echo " make bootstrap-personal - Setup personal configuration"
@echo " make bootstrap-work - Setup work configuration"
@echo ""
@echo "Management commands:"
@echo " make switch - Apply current configuration"
@echo " make update - Update flake inputs and apply"
@echo " make rollback - Rollback to previous generation"
@echo " make clean - Clean old generations (keep last 5)"
@echo " make rebuild - Rebuild without switching"
@echo ""
@echo "Testing commands:"
@echo " make test - Run all Fishtape tests"
@echo " make test-packages - Run package availability tests"
@echo " make test-fish-config - Run Fish configuration tests"
@echo ""
@echo "Release commands:"
@echo " make release - Create new release based on conventional commits"
@echo ""
@echo "Linux commands:"
@echo " make bootstrap-linux - Bootstrap Linux (CachyOS) configuration"
@echo " make switch-linux - Apply Linux home-manager configuration"
@echo " make install-pacman-deps - Install required pacman/AUR packages"
@echo ""
@echo "Installation commands:"
@echo " make install-nix - Install Nix with flakes support"
@echo " make install-darwin - Install nix-darwin"
# Check if Nix is installed
.PHONY: check-nix
check-nix:
@command -v nix >/dev/null 2>&1 || { echo "Nix not found. Run 'make install-nix' first."; exit 1; }
# Install Nix with flakes support
.PHONY: install-nix
install-nix:
@echo "Installing Nix with flakes support..."
@curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
@echo "Nix installed! Please restart your shell and run the bootstrap command again."
# Install nix-darwin
.PHONY: install-darwin
install-darwin: check-nix
@echo "Installing nix-darwin..."
@nix run nix-darwin -- switch --flake .
@echo "nix-darwin installed!"
# Bootstrap commands
.PHONY: bootstrap-personal
bootstrap-personal:
@echo "Bootstrapping personal configuration..."
@$(MAKE) _bootstrap CONFIG=$(PERSONAL_CONFIG)
.PHONY: bootstrap-work
bootstrap-work:
@echo "Bootstrapping work configuration..."
@$(MAKE) _bootstrap CONFIG=$(WORK_CONFIG)
# Internal bootstrap implementation
.PHONY: _bootstrap
_bootstrap: check-nix
@echo "Setting up $(CONFIG) configuration..."
@# Install nix-darwin if not already installed
@if ! command -v darwin-rebuild >/dev/null 2>&1; then \
echo "Installing nix-darwin..."; \
nix run nix-darwin -- switch --flake .#$(CONFIG); \
else \
echo "Applying $(CONFIG) configuration..."; \
darwin-rebuild switch --flake .#$(CONFIG); \
fi
@echo "Bootstrap complete! Configuration $(CONFIG) is now active."
@echo "You may need to restart your terminal for all changes to take effect."
# Apply current configuration (requires darwin-rebuild to be available)
.PHONY: switch
switch:
@echo "Applying current configuration..."
@sudo -E /run/current-system/sw/bin/darwin-rebuild switch --flake .#personal
# Update flake inputs and apply
.PHONY: update
update:
@echo "Updating flake inputs..."
@nix flake update
@echo "Applying updated configuration..."
@sudo -E /run/current-system/sw/bin/darwin-rebuild switch --flake .#personal
# Rollback to previous generation
.PHONY: rollback
rollback:
@echo "Rolling back to previous generation..."
@sudo -E /run/current-system/sw/bin/darwin-rebuild rollback
# Rebuild without switching
.PHONY: rebuild
rebuild:
@echo "Building configuration..."
@sudo -E /run/current-system/sw/bin/darwin-rebuild build --flake .#personal
# Clean old generations (keep last 5)
.PHONY: clean
clean:
@echo "Cleaning old generations (keeping last 5)..."
@sudo nix-collect-garbage --delete-older-than 30d
@nix-collect-garbage --delete-older-than 30d
# Show current generation and available rollback options
.PHONY: generations
generations:
@echo "Current generation and rollback options:"
@sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
# Show flake info
.PHONY: info
info:
@echo "Flake information:"
@nix flake show
# Validate configuration without building
.PHONY: check
check:
@echo "Checking flake configuration..."
@nix flake check
# Testing commands (integrated from test/Makefile)
.PHONY: test test-packages test-fish-config
test: ## Run all Fishtape tests (recommended)
@echo "π Running Fishtape tests..."
@cd test && fish -i -c "fishtape packages.test.fish fish-config.test.fish; exit"
test-packages: ## Run package availability tests
@echo "π Testing Nix packages with Fishtape..."
@cd test && fish -i -c "fishtape packages.test.fish; exit"
test-fish-config: ## Run Fish configuration tests
@echo "π Testing Fish shell configuration..."
@cd test && fish -i -c "fishtape fish-config.test.fish; exit"
# Release commands
.PHONY: release
release: ## Create new release based on conventional commits
@echo "π Creating new release based on conventional commits..."
@command -v cog >/dev/null 2>&1 || { echo "β Cocogitto (cog) not found. Run 'make switch' to install it."; exit 1; }
@echo "π Analyzing conventional commits since last tag..."
@cog bump --auto
@echo "π·οΈ Pushing tag to remote to trigger GitHub release..."
@git push origin $$(git describe --tags --abbrev=0)
@echo "β
Release created and pushed! GitHub workflow will create the release automatically."
# ββ Linux (CachyOS/Hyprland) targets ββ
# Bootstrap Linux configuration (first-time setup)
.PHONY: bootstrap-linux
bootstrap-linux: check-nix
@echo "Bootstrapping Linux (CachyOS) configuration..."
@$(MAKE) install-pacman-deps
@nix run home-manager -- switch -b backup --flake .#$(LINUX_CONFIG)
@echo "Bootstrap complete! You may need to restart Hyprland for all changes to take effect."
# Apply Linux home-manager configuration
.PHONY: switch-linux
switch-linux: check-nix
@echo "Applying Linux home-manager configuration..."
@home-manager switch -b backup --flake .#$(LINUX_CONFIG)
# Install required pacman/AUR packages for the Linux setup
.PHONY: install-pacman-deps
install-pacman-deps:
@echo "Installing system packages via pacman..."
sudo pacman -S --needed ghostty ghostty-shell-integration hyprlock hypridle playerctl fuzzel awww yad dms-shell-hyprland matugen
@echo "Installing GUI apps via pacman..."
sudo pacman -S --needed vesktop freetube spotify-launcher
@echo "Installing AUR packages via paru..."
paru -S --needed zapzap
@echo "All system packages installed."
# Setup Spotify Rose Pine theme via spicetify
.PHONY: setup-spotify-theme
setup-spotify-theme:
@echo "Setting up Spotify Rose Pine theme..."
@spicetify config current_theme catppuccin
@spicetify config color_scheme macchiato
@spicetify config inject_css 1 replace_colors 1
@spicetify backup apply
@echo "Spotify theme applied! Restart Spotify to see changes."