-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
52 lines (44 loc) · 1.45 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
# https://stackoverflow.com/a/30176470
.DEFAULT_GOAL := default
PLATFORM := $(shell uname)
all: default rebuild-fswatch rebuild-watchman rebuild-impure/nixos
default:
ifeq (${PLATFORM}, Darwin)
darwin-rebuild switch --verbose -L --flake . && \
osascript -e 'display notification "🟢 Darwin rebuild successful!" with title "Nix configuration"' || \
osascript -e 'display notification "🔴 Darwin rebuild failed!" with title "Nix configuration"'
else
nixos-rebuild switch --use-remote-sudo --verbose -L --flake .
endif
machine-specific:
darwin-rebuild switch --verbose -L --flake ".#Ivans-MBP0" && \
osascript -e 'display notification "🟢 Darwin rebuild successful!" with title "Nix configuration"' || \
osascript -e 'display notification "🔴 Darwin rebuild failed!" with title "Nix configuration"'
rebuild-fswatch:
echo "Watching for changes..."; \
git ls-files | xargs fswatch -o | while read -r event; do \
echo "Change detected, running make to rebuild configuration..."; \
$(MAKE) default; \
done
rebuild-watchman:
watchman-make \
--pattern \
'**/*.nix' \
'**/*.sh' \
'**/*.fish' \
'**/*.lua' \
'**/*.py' \
'flake.lock' \
--target default
rebuild-watchman-machine-specific:
watchman-make \
--pattern \
'**/*.nix' \
'**/*.sh' \
'**/*.fish' \
'**/*.lua' \
'**/*.py' \
'flake.lock' \
--target machine-specific
rebuild-impure/nixos:
nixos-rebuild switch --use-remote-sudo --impure --verbose -L --flake .