update build-installer to work on non guix systems

This commit is contained in:
Murphy 2024-12-12 19:44:06 -05:00
parent d87f3b7b72
commit dea0707f22
Signed by: freya
GPG key ID: 9FBC6FFD6D2DBF17

View file

@ -1,6 +1,27 @@
#!/bin/sh #!/bin/sh
retry="$(dirname $0)/guix-retry" retry="$(dirname $0)/guix-retry"
repo="$(realpath "$(dirname $0)/..")" repo="$(realpath "$(dirname $0)/..")"
extra_args=""
if [ ! -d /gnu/store ]; then
# we are likely in a non guix system
# just for building the installer
# make sure to authorize the substitute
# servers for nonguix and sakura
guix archive --authorize < "$repo/files/keys/nonguix.pub"
guix archive --authorize < "$repo/files/keys/sakura.pub"
substitutes=$((cat <<EOF
https://substitutes.nonguix.org
https://substitutes.freya.cat
https://bordeaux.guix.gnu.org
https://ci.guix.gnu.org
EOF
) | tr '\n' ' ')
extra_args="--substitute-urls=\"$substitutes\""
fi
command="\"$retry\" guix time-machine -C \"$repo/channels.scm\" $extra_args -- system -L \"$repo/modules\" image -t iso9660 \"$repo/systems/installer.scm\""
image=$(sh -c "$command")
date="$(date -Iseconds)" date="$(date -Iseconds)"
image=$("$retry" guix system -L "$repo/modules" image -t iso9660 "$repo/systems/installer.scm") cp $image "guix-installer-$date.iso"
cp $image "./guix-installer-$date.iso"