forked from Gaming-Linux-FR/GLF-OS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (37 loc) · 1.36 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
# make without argument will perform a iso & install
all: iso install
# Check configuration only without build
check:
nix --extra-experimental-features "nix-command flakes" flake check --no-build
# Check configuration only with build
build:
nix --extra-experimental-features "nix-command flakes" build -L .#nixosConfigurations.glf-installer.config.system.build.toplevel
# Build new iso
iso:
nix --extra-experimental-features "nix-command flakes" build -L .#iso
build-vm:
nixos-rebuild build-vm -I nixos-config=./nix-cfg/configuration.nix && ./result/bin/run-glfos-vm
# Update flake.lock
update:
nix --extra-experimental-features "nix-command flakes" flake update
# Clean local build
clean:
@if [ -L "result" ]; then rm result; fi
nix-collect-garbage
@if [ -d "iso" ]; then rm -r iso; fi
# Copy image and compute sha256sum
SRC_DIR = result/iso
DEST_DIR = iso
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
install:
@SRC_IMG=$$(ls -t $(SRC_DIR) | tail -1); \
DST_IMG="$${SRC_IMG/-x86_64-linux.iso/_$(GIT_BRANCH).iso}"; \
if [ -n "$$SRC_IMG" ]; then \
echo "Copying $(SRC_DIR)/$$SRC_IMG to $(DEST_DIR)/$$DST_IMG ..."; \
install -d $(DEST_DIR); \
install -m 644 "$(SRC_DIR)/$$SRC_IMG" $(DEST_DIR)/$$DST_IMG && \
cd $(DEST_DIR) && \
sha256sum "$$DST_IMG" > "$$DST_IMG.sha256sum"; \
cat "$$DST_IMG.sha256sum"; \
fi
.PHONY: all test clean iso update install