-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
106 lines (82 loc) · 3.14 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
GUIX_PROFILE := target/profiles/guix
GUIX_PROFILE_LOCAL := target/profiles/guix-local
PROFILE := ${GUIX_PROFILE_LOCAL}
LOCK := rde/channels-lock.scm
LOCK_LOCAL := rde/channels-lock-local.scm
CHANNELS := ${LOCK_LOCAL}
GUIX := ./pre-inst-env ${PROFILE}/bin/guix
GUIX_LOCAL := ../../guile/guix/pre-inst-env ./pre-inst-env guix
GUIX_LOCK := ${GUIX} time-machine --disable-authentication -C ${CHANNELS} --
CMD := $(GUIX_LOCK)
ENTRY := ./guix.scm
HOST := $(shell hostname)
USER := $(shell whoami)
EXTRA_OPTIONS := --substitute-urls=https://ci.guix.gnu.org
%/local: CMD := ${GUIX_LOCAL}
%/local: CHANNELS := ${LOCK_LOCAL}
%/local: PROFILE := ${GUIX_PROFILE_LOCAL}
%/external: CHANNELS := ${LOCK}
%/external: PROFILE := ${GUIX_PROFILE}
.PHONY: all
all: guix pull upgrade home system iso
rde/channels-lock.scm: rde/channels.scm
guix time-machine -C rde/channels.scm -- \
describe -f channels > rde/channels-lock-tmp.scm
mv rde/channels-lock-tmp.scm rde/channels-lock.scm
rde/channels-lock-local.scm: rde/channels-local.scm
guix time-machine --disable-authentication -C rde/channels-local.scm -- \
describe -f channels > rde/channels-lock-tmp.scm
mv rde/channels-lock-tmp.scm rde/channels-lock-local.scm
guix: target/guix-time-marker
repl:
${GUIX} shell guile-next guix guile-ares-rs -- guile \
-c "((@ (nrepl server) run-nrepl-server) #:port 7888)"
target:
mkdir target
target/profiles:
mkdir -p target/profiles
target/guix-time-marker: ${CHANNELS}
make ${PROFILE}
touch $@
target/profiles/guix: target/profiles rde/channels-lock.scm
guix pull --allow-downgrades -C rde/channels-lock.scm \
-p ${GUIX_PROFILE}
target/profiles/guix-local: target/profiles rde/channels-lock-local.scm
guix pull --disable-authentication --allow-downgrades \
-C rde/channels-lock-local.scm -p ${GUIX_PROFILE_LOCAL}
target/live.iso: guix target
RDE_TARGET=system RDE_HOST=live ${CMD} \
system -L . image -t iso9660 $(ENTRY) -r target/live-tmp.iso \
mv target/live-tmp.iso target/live.iso
clean-target:
rm -rf ./target
clean: clean-target
build/%: guix
RDE_TARGET=system $(if $(word 3, $(subst /, , $@)),RDE_HE_IN_OS=true )\
RDE_USER=$(word 3, $(subst /, ,$@)) \
RDE_HOST=$(word 2, $(subst /, ,$@)) ${CMD} \
system build $(ENTRY)
deploy/%: guix
RDE_TARGET=deploy $(if $(word 3, $(subst /, , $@)),RDE_HE_IN_OS=true )\
RDE_USER=$(word 3, $(subst /, ,$@)) \
RDE_HOST=$(word 2, $(subst /, ,$@)) ${CMD} \
deploy $(ENTRY)
home: home/reconfigure/${USER}
home/local: home/reconfigure/${USER}/local
home/build/%: guix
RDE_TARGET=home RDE_HOST= RDE_USER=$(word 1, $(subst /, ,$*)) ${CMD} \
home build $(ENTRY)
home/reconfigure/%: guix
RDE_TARGET=home RDE_USER=$(word 1, $(subst /, ,$*)) ${CMD} \
home --allow-downgrades reconfigure $(ENTRY)
system: system/reconfigure/${HOST}
system/local: system/reconfigure/${HOST}/local
system/init/%:
RDE_TARGET=system RDE_HOST=$(word 1, $(subst /, ,$*)) \
RDE_HE_IN_OS=true ${CMD} init $(ENTRY) /mnt
system/build/%: guix
RDE_TARGET=system RDE_HOST=$(word 1, $(subst /, ,$*)) \
RDE_USER= ${CMD} system build $(ENTRY)
system/reconfigure/%: guix
RDE_TARGET=system RDE_HOST=$(word 1, $(subst /, ,$*)) \
sudo -E ${CMD} system --allow-downgrades reconfigure $(ENTRY)