-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile.nixos
More file actions
34 lines (24 loc) · 834 Bytes
/
Makefile.nixos
File metadata and controls
34 lines (24 loc) · 834 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
28
29
30
31
32
33
34
# -*- mode: makefile -*-
machine ?= sruxps
nixos_dir ?= /etc/nixos
all:: generate-config
build dry-build: stow
@ nixos-rebuild --option pure-eval false $@
switch test: stow
@ sudo nixos-rebuild --option pure-eval false $@
diff: build
@ nix store diff-closures /run/current-system ./result
.PHONY: generate-config
generate-config: machines/${machine}/hardware-configuration.nix
machines/${machine}/hardware-configuration.nix:
nixos-generate-config --root ${PWD} --dir $(@D)
nixpkgs-fmt $@
.PHONY: secrets
secrets: $(patsubst %.enc,%,$(wildcard machines/${machine}/secrets/*.enc))
@ sudo mkdir -p ${nixos_dir}/$@
@ sudo ${stow} -t ${nixos_dir}/$@ -d machines/${machine} $@
stow:: secrets
stow::
@ sudo mkdir -p ${nixos_dir}/$@
@ sudo ${stow} -t ${nixos_dir} .
@ sudo ${stow} -t ${nixos_dir} -d machines ${machine}