-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
70 lines (62 loc) · 1.68 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
_NIX_FILES := $(shell find . -name '*.nix')
_UNAME := $(shell uname)
_ARCH := $(shell uname -m)
_WSL_DISTRO := $(WSL_DISTRO_NAME)
.PHONY: all fmt update dry-run switch os/dry-run os/switch
all: fmt
fmt:
nixfmt $(_NIX_FILES)
update:
nix flake update
dry-run:
ifeq ($(_UNAME),Darwin)
ifeq ($(_ARCH),arm64)
home-manager build --dry-run --flake '.#henry@darwin'
else ifeq ($(_ARCH),x86_64)
home-manager build --dry-run --flake '.#henry@darwin-legacy'
else
$(error Unsupported architecture)
endif
else
ifeq ($(_ARCH),aarch64)
home-manager build --dry-run --flake '.#nixos@linux-aarch64'
else ifeq ($(_ARCH),x86_64)
home-manager build --dry-run --flake '.#nixos@linux-x86_64'
else
$(error Unsupported architecture)
endif
endif
switch:
ifeq ($(_UNAME),Darwin)
ifeq ($(_ARCH),arm64)
home-manager switch --flake '.#henry@darwin'
else ifeq ($(_ARCH),x86_64)
home-manager switch --flake '.#henry@darwin-legacy'
else
$(error Unsupported architecture)
endif
else
ifeq ($(_ARCH),aarch64)
home-manager switch --flake '.#nixos@linux-aarch64'
else ifeq ($(_ARCH),x86_64)
home-manager switch --flake '.#nixos@linux-x86_64'
else
$(error Unsupported architecture)
endif
endif
os/dry-run:
ifneq ($(_WSL_DISTRO),)
sudo nixos-rebuild dry-build --flake ".#wsl" --impure
else ifeq ($(_UNAME),Darwin)
$(error Darwin is not supported)
else ifeq ($(_UNAME),Linux)
sudo nixos-rebuild dry-build --flake ".#vm" --impure
endif
os/switch:
ifneq ($(_WSL_DISTRO),)
sudo nixos-rebuild switch --flake ".#wsl" --impure
else ifeq ($(_UNAME),Darwin)
$(error Darwin is not supported)
else ifeq ($(_UNAME),Linux)
sudo nixos-rebuild switch --flake ".#vm" --impure
endif