-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
27 lines (24 loc) · 684 Bytes
/
Copy pathMakefile
File metadata and controls
27 lines (24 loc) · 684 Bytes
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
.PHONY: switch update install-nix
switch:
@nh='nh'; \
if ! command -v nh >/dev/null 2>&1; then nh='nix run nixpkgs#nh --'; fi; \
if [ "$$(uname)" = Darwin ]; then \
$$nh darwin switch . -H "$$(hostname -s)"; \
else \
$$nh os switch . -H "$$(hostname -s)"; \
fi
update:
nix run .#write-flake
nix flake update
$(MAKE) switch
install-nix:
@if [ "$$(uname)" != "Darwin" ]; then \
echo "install-nix is only supported on macOS."; \
exit 0; \
fi
@if command -v nix >/dev/null 2>&1; then \
echo "Nix is already installed."; \
else \
echo "Installing Nix..."; \
curl -sSfL https://artifacts.nixos.org/nix-installer | sh -s -- install --enable-flakes; \
fi