Files
vms/distros/nixos/23.05/amd64.pkrvars.hcl.sh
T
Greg HellingsandGitHub ebbc8a7371 Hyperv (#14)
* Do not commit the .venv file

* Fix packer formatting issues

* I am, once again, asking to fix the cache path

* Fix URI generation for tests

* Prevent prompting during Hyper-V tests

* Add more waits to hopefully build on GHA

* Hyper-V ISO expansion

Expand coverage of Hyper-V ISO to all distros except Debian
Simplify a few steps in the update/upgrade process for VMs
Edit the test script for Windows support

* Fix plugin cache path on Mac

* Point to the correct mirror URL
2023-12-07 12:15:48 -06:00

43 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -exo pipefail
# Name of the file to write out
name="${0%.sh}"
version="23.05"
# Base URL
base="https://channels.nixos.org/nixos-${version}/latest-nixos-minimal-x86_64-linux.iso"
# Working directory
tmp="$(mktemp -d)"
checksums="${tmp}/checksums"
# Read the SHA256 sum value
curl -L -o "${checksums}" "${base}.sha256"
until curl -f -L -o "${checksums}" "${base}.sha256"; do
sleep 1
done
sha="$(grep -e minimal "${checksums}" | cut -d' ' -f 1)"
# Write out HCL file
cat << EOF > "${name}"
distro = "nixos"
version = "${version}"
iso = {
url = "${base}"
checksum = "${sha}"
}
boot_command = [
"<tab><wait> net.ifnames=0<wait> <wait>bi<wait>osdevnames=0<enter>",
"<wait60>", # Wait for system to come up?
"curl<wait> -o<wait> /tmp/install.sh<wait> http://<wait>{{ .HTTPIP }}<wait>:{{ .HTTPPort }}<wait>/install.sh<enter>",
"<wait>",
"sudo<wait> bash<wait> /tmp/install.sh<wait> {{ .HTTPPort }}<wait> {{ .HTTPIP }}<enter>"
]
http_directory = "distros/nixos/23.05/http/"
boot_wait = "5s"
EOF
rm -r "${tmp}"