-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (29 loc) · 994 Bytes
/
Makefile
File metadata and controls
41 lines (29 loc) · 994 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
35
36
37
38
39
40
41
OUTDIR:=./.out
ARTIFACT_NAME:=mypios.img
EXAMPLES := $(wildcard config/*.example.toml)
CONFIGS := $(patsubst config/%.example.toml,config/%.toml,$(EXAMPLES))
.PHONY: setup-config
.init-output:
mkdir -p ${OUTDIR}
.guard-%:
@ if [ "${${*}}" = "" ]; then \
echo "Environment variable $* not set"; \
exit 1; \
fi
setup-pathing:
sed -i 's|/home/jack/dev/nix-pi-base|$(shell pwd)|g' flake.nix
setup-config: $(CONFIGS)
config/%.toml: config/%.example.toml
cp $< $@
update-config:
nix flake lock --update-input networking-config
nix flake lock --update-input user-config
.decompress-build: .init-output
unzstd result/sd-image/nixos-image-sd-card-*-aarch64-linux.img.zst -o ${OUTDIR}/${ARTIFACT_NAME}
build: update-config
nix build --impure .#packages.aarch64-linux.sdcard --system aarch64-linux
safe-eject: .guard-DEVICE
sync
sudo eject ${DEVICE}
flash: .guard-DEVICE .decompress-build
sudo dd if=${OUTDIR}/${ARTIFACT_NAME} of=${DEVICE} bs=8M status=progress conv=fsync