2023-10-03 07:22:54 +02:00
|
|
|
# Copyright (C) 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
|
|
#
|
|
|
|
# This file is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
# your option) any later version.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this file. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2023-10-03 07:21:24 +02:00
|
|
|
.PHONY: all deploy
|
2023-09-22 02:45:34 +02:00
|
|
|
|
|
|
|
all: guix-installer-vm.img
|
|
|
|
|
|
|
|
# Generate default key. Can be changed by replacing id_ed25519.pub.
|
|
|
|
id_ed25519.pub:
|
|
|
|
printf "ssh-ed25519 %s %s" \
|
|
|
|
'AAAAC3NzaC1lZDI1NTE5AAAAIH2feuEj4asx0ImCG+cuiPv2WdKF6vMI+cJtZyG9cwUQ' \
|
2023-10-03 07:01:14 +02:00
|
|
|
'gnutoo@primary_laptop' \
|
2023-09-22 02:45:34 +02:00
|
|
|
> $@
|
|
|
|
|
|
|
|
# Generate default key. Can be changed by replacing signing-key.pub.
|
|
|
|
signing-key.pub:
|
|
|
|
printf '(public-key (ecc (curve Ed25519) (q #%s#)))\n' \
|
|
|
|
'3A7E1F41E2D5784CFCABB39CB73F99E727D4A5C1ECA79D873587D63D093CC4B5' \
|
|
|
|
>$@
|
|
|
|
|
|
|
|
# We want to only update the image when guix commit changes. The trick
|
|
|
|
# to make that work is to only create or update a file when the revision
|
|
|
|
# changes.
|
|
|
|
guix-commit.txt: Makefile
|
|
|
|
if [ ! -f $@ ] ; then \
|
|
|
|
guix describe | grep '^ commit:' | awk '{print $$2}' > $@ ; \
|
|
|
|
elif [ "$(cat $@)" != \
|
|
|
|
"$(guix describe | \
|
|
|
|
grep '^ commit:' | awk '{print $$2}')" ] ; then \
|
|
|
|
guix describe | grep '^ commit:' | awk '{print $$2}' > $@ ; \
|
|
|
|
fi
|
|
|
|
|
2023-10-02 21:39:06 +02:00
|
|
|
TARBALL_SOURCE = \
|
|
|
|
first-boot.sh \
|
2023-09-22 02:45:34 +02:00
|
|
|
guix-commit.txt \
|
|
|
|
guix-installer-vm-system.scm \
|
|
|
|
id_ed25519.pub \
|
|
|
|
Makefile \
|
|
|
|
signing-key.pub
|
|
|
|
|
2023-10-02 21:39:06 +02:00
|
|
|
guix-installer-vm.tar: $(TARBALL_SOURCE)
|
|
|
|
tar --exclude "id_ed25519" -cf $@ $(TARBALL_SOURCE)
|
|
|
|
|
|
|
|
guix-installer-vm.tar.xz: guix-installer-vm.tar
|
|
|
|
xz -f -9e --verbose $<
|
|
|
|
|
2023-10-02 22:08:43 +02:00
|
|
|
guix-installer-vm.tar.xz.b64: guix-installer-vm.tar.xz
|
|
|
|
base64 $< > $@
|
|
|
|
|
2023-10-02 21:39:06 +02:00
|
|
|
IMAGE_SOURCE = \
|
|
|
|
$(TARBALL_SOURCE) \
|
|
|
|
guix-installer-vm.tar.xz
|
|
|
|
|
2023-09-22 02:45:34 +02:00
|
|
|
guix-installer-vm.img: $(IMAGE_SOURCE)
|
|
|
|
install \
|
|
|
|
`guix system image \
|
|
|
|
--image-type=mbr-raw \
|
|
|
|
--image-size=4G guix-installer-vm-system.scm` \
|
|
|
|
$@
|
|
|
|
|
2023-10-03 07:21:24 +02:00
|
|
|
deploy:
|
|
|
|
guix deploy -L . guix-installer-vm-machine.scm
|