2
2
3
3
NIX_FILES := $(shell find . -name '* .nix')
4
4
UNAME := $(shell uname)
5
+ ARCH := $(shell uname -m)
5
6
WSL_DISTRO := $(strip $(WSL_DISTRO_NAME ) )
6
7
7
8
fmt :
@@ -14,17 +15,31 @@ update:
14
15
15
16
dry-run :
16
17
ifeq ($(UNAME ) , Darwin)
17
- # Darwin
18
+ ifeq ($(ARCH ) , arm64)
19
+ # Darwin (arm64)
18
20
home-manager build --dry-run --flake '.# henry@darwin'
21
+ else ifeq ($(ARCH), x86_64)
22
+ # Darwin (x86_64)
23
+ home-manager build --dry-run --flake '.# henry@darwin-legacy'
24
+ else
25
+ $(error Unsupported architecture)
26
+ endif
19
27
else
20
28
# WSL & VM
21
29
home-manager build --dry-run --flake '.# nixos@all'
22
30
endif
23
31
24
32
switch :
25
33
ifeq ($(UNAME ) , Darwin)
26
- # Darwin
34
+ ifeq ($(ARCH ) , arm64)
35
+ # Darwin (arm64)
27
36
home-manager switch --flake '.# henry@darwin'
37
+ else ifeq ($(ARCH), x86_64)
38
+ # Darwin (x86_64)
39
+ home-manager switch --flake '.# henry@darwin-legacy'
40
+ else
41
+ $(error Unsupported architecture)
42
+ endif
28
43
else
29
44
# WSL & VM
30
45
home-manager switch --flake '.# nixos@all'
@@ -36,7 +51,7 @@ os/dry-run:
36
51
ifdef WSL_DISTRO
37
52
sudo nixos-rebuild dry-build --flake ".# wsl" --impure
38
53
else ifeq ($(UNAME), Darwin)
39
- $(info Darwin is not supported)
54
+ $(error Darwin is not supported)
40
55
else ifeq ($(UNAME), Linux)
41
56
sudo nixos-rebuild dry-build --flake ".# vm" --impure
42
57
endif
@@ -45,7 +60,7 @@ os/switch:
45
60
ifdef WSL_DISTRO
46
61
sudo nixos-rebuild switch --flake ".# wsl" --impure
47
62
else ifeq ($(UNAME), Darwin)
48
- $(info Darwin is not supported)
63
+ $(error Darwin is not supported)
49
64
else ifeq ($(UNAME), Linux)
50
65
sudo nixos-rebuild switch --flake ".# vm" --impure
51
66
endif
0 commit comments