-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (48 loc) · 2.08 KB
/
Copy pathMakefile
File metadata and controls
61 lines (48 loc) · 2.08 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
.PHONY: all bootstrap check format rebuild rekey regenerate-keys sync update upgrade
HOSTNAME := $(shell hostname)
NIX_REBUILD_FLAGS :=
NIX_REBUILD_ENV :=
ATTIC_URL := http://opal:8180/dotnix
ATTIC_PUBLIC_KEY := dotnix:N7VDgNbJ+yj6YV97+97s5HrxQ38+27OSPm17BexG3qA=
# Replace stale cache URLs/keys during bootstrap, and pass configuration through
# sudo to every Nix subprocess instead of relying on --option extra-* flags.
ATTIC_BOOTSTRAP_ENV = env NIX_CONFIG="$$(printf '%s\n' "$$NIX_CONFIG" \
'substituters = https://cache.nixos.org/ $(ATTIC_URL)' \
'trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= $(ATTIC_PUBLIC_KEY)')"
ifeq ($(HOSTNAME),santisasahi)
NIX_REBUILD_FLAGS += --impure
endif
# Detect system type (Linux or Darwin)
SYS_TYPE := $(shell uname -s)
all:
@echo "no command supplied (bootstrap/check/format/rebuild/rekey/update/upgrade)"
rekey:
nix-shell -p sops --run "sops updatekeys secrets/*.yaml"
regenerate-keys: rekey
format:
nix fmt
nix develop --command stylua -g "*.lua" -- $(CURDIR)/configs/nvim
check:
nix eval .#darwinConfigurations.santibook.system.drvPath --raw
nix eval .#nixosConfigurations.opal.config.system.build.toplevel.drvPath --raw
nix eval .#nixosConfigurations.lime.config.system.build.toplevel.drvPath --raw
nix eval .#nixosConfigurations.jade.config.system.build.toplevel.drvPath --raw
nix eval .#nixosConfigurations.ruby.config.system.build.toplevel.drvPath --raw
nix eval .#nixosConfigurations.santisasahi.config.networking.hostName --raw
nix eval .#nixosConfigurations.santisasahi.config.home-manager.users.santi.home.activationPackage.drvPath --raw
rebuild:
ifeq ($(SYS_TYPE),Linux)
@echo "Rebuilding NixOS configuration..."
sudo $(NIX_REBUILD_ENV) nixos-rebuild switch --flake .#$(HOSTNAME) $(NIX_REBUILD_FLAGS)
endif
ifeq ($(SYS_TYPE),Darwin)
@echo "Rebuilding Darwin configuration..."
sudo $(NIX_REBUILD_ENV) darwin-rebuild switch --flake .#$(HOSTNAME) $(NIX_REBUILD_FLAGS)
endif
sync:
git pull
bootstrap: NIX_REBUILD_ENV = $(ATTIC_BOOTSTRAP_ENV)
bootstrap: rebuild
update:
nix flake update
upgrade: sync rebuild