Change NixOS to dynamic

This commit is contained in:
Greg Hellings
2023-08-23 11:19:02 -05:00
parent b43b95e124
commit 4f03ff3d62
2 changed files with 42 additions and 15 deletions
-15
View File
@@ -1,15 +0,0 @@
distro = "nixos"
version = "23.05"
iso = {
url = "https://channels.nixos.org/nixos-23.05/latest-nixos-minimal-x86_64-linux.iso"
checksum = "e2a0bc2be3b6638692393a19435838d464149914dbd942010e31a3c8c84c82d5"
}
boot_command = [
"<tab><wait> net.ifnames=0<wait> <wait>bi<wait>osdevnames=0<enter>",
"<wait60>", # Wait for system to come up?
"curl -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh<enter>",
"<wait>",
"sudo bash /tmp/install.sh {{ .HTTPPort }} {{ .HTTPIP }}<enter>"
]
http_directory = "distros/nixos/23.05/http/"
boot_wait = "5s"
+42
View File
@@ -0,0 +1,42 @@
#!/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="$(cat "${checksums}" | grep minimal | 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 -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh<enter>",
"<wait>",
"sudo bash /tmp/install.sh {{ .HTTPPort }} {{ .HTTPIP }}<enter>"
]
http_directory = "distros/nixos/23.05/http/"
boot_wait = "5s"
EOF
rm -r "${tmp}"