Merge branch 'update-distros-june-2024' into 'main'

June 2024 distro updates

Closes #12

See merge request greg/vms!11
This commit is contained in:
Greg Hellings
2024-07-18 15:04:12 +00:00
62 changed files with 582 additions and 70 deletions
+1
View File
@@ -9,6 +9,7 @@ isolinux.cfg
Vagrantfile
.direnv
result
packer_config/
# Generated distros
distros/fedora/rawhide/*.hcl
+10 -10
View File
@@ -31,17 +31,8 @@ stages:
PACKER_CONFIG_DIR: ./packer_config/
PACKER_CACHE_DIR: ./cache/
PACKER_LOG: 1
COMMAND: >
packer build ${only}
-var-file="${distro}"
-var build=${BUILD}
-var cpus=2
-var memory=4096
${EXCEPT}
sources
script:
- echo $COMMAND > build.sh
- bash build.sh || exit 1
- nix run ".#\"${buildcmd}\"" || exit 1
qemu.amd64:
extends: .build
@@ -67,9 +58,18 @@ hyperv-iso.amd64:
<<: *variables
only: '-only="hyperv-iso.amd64"'
tag: hyperv
COMMAND: >
packer build ${only}
-var-file="${distro}"
-var build=${BUILD}
-var cpus=2
-var memory=4096
${EXCEPT}
sources
parallel:
matrix: HYPERV_MATRIX
script:
- packer init sources
- echo $env:COMMAND > build.ps1
- echo 'if (-not $?) { throw "Error in build"}' >> build.ps1
- pwsh .\build.ps1
+1 -1
View File
@@ -8,7 +8,7 @@ boot_command = [
"<up>e<wait>",
"<down><down><end><wait>",
" inst.text inst.ks=cdrom:/ks.cfg",
" console=ttyS0 inst.notmux",
" inst.notmux",
"<leftCtrlOn>x<leftCtrlOff>"
]
cd_files = [ "distros/almalinux/9/disc/*" ]
+2 -2
View File
@@ -1,8 +1,8 @@
distro = "alpine"
version = "3.19.0"
iso = {
url = "https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/x86_64/alpine-standard-3.19.0-x86_64.iso"
checksum = "4cf7cd3bad64122a8a2423e78369a486a02334d4d88645aab9d08120bb76b0f9"
url = "http://dl-cdn.alpinelinux.org/alpine/v3.19/releases/x86_64/alpine-extended-3.19.2-x86_64.iso"
checksum = "508944822217be4c2c7b947a64220271055b1883a025e5cb351950b27f046a15"
}
boot_command = [
"root<enter><wait1>",
+19
View File
@@ -0,0 +1,19 @@
distro = "alpine"
version = "3.20"
iso = {
url = "http://dl-cdn.alpinelinux.org/alpine/v3.20/releases/x86_64/alpine-standard-3.20.1-x86_64.iso"
checksum = "c3043af6421b6e0ab22994b01d10785728888b37d976a754f12f23b42aecd95e"
}
boot_command = [
"root<enter><wait1>",
"echo 'iface eth0 inet dhcp' > /etc/network/interfaces<enter><wait>",
"ifup eth0<enter><wait8>",
"wget -O answers.cfg.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/answers.cfg.sh<enter>",
"<wait3>",
"wget -O in-chroot.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/in-chroot.sh<enter>",
"<wait3>",
"/bin/ash ./answers.cfg.sh 2>&1 | tee install.log<enter>",
]
http_directory = "distros/alpine/3.20/http/"
boot_wait = "20s"
shutdown_command = "sudo poweroff"
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
set -ex
+61
View File
@@ -0,0 +1,61 @@
#!/bin/ash
# shellcheck shell=dash
set -ex -o pipefail
if [ -e /dev/vda ]; then
disk="/dev/vda"
else
disk="/dev/sda"
fi
cat << EOF > answers.cfg
KEYMAPOPTS="us us"
HOSTNAMEOPTS="vagrant"
DEVDOPTS=mdev
INTERFACESOPTS="auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname vagrant.local"
TIMEZONEOPTS="UTC"
PROXYOPTS="none"
# Add first CDN mirror
APKREPOSOPTS="-1"
USEROPTS="-a -u -g audio,video,netdev vagrant"
SSHDOPTS=openssh
NTPOPTS=none
DISKOPTS="-m sys ${disk}"
LBUOPTS=none
APKCACHEOPTS=none
EOF
setup-alpine -e -f answers.cfg -q
yes y | setup-disk -m sys "${disk}" || true
# It isn't setting up disk in initial run, but
# it also can't setup disk before the rest of it
# is setup properly. There might be a better workaround
# but this is what I'm choosing to do
setup-alpine -e -f answers.cfg -q
mount "${disk}3" /mnt
mount "${disk}1" /mnt/boot
mv in-chroot.sh /mnt
for fs in proc sys dev sys/firmware/efi/efivars; do mount -o bind /${fs} /mnt/${fs}; done
chroot /mnt /bin/ash /in-chroot.sh
rm /mnt/in-chroot.sh
reboot
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env sh
set -ex
# Enables packages like "sudo"
sed -i 's/#\(.*\/community\)/\1/' /etc/apk/repositories
# Install bare minimal packages
apk add curl efibootmgr openssh sudo virt-what
rc-update add sshd default
# Configure systems
echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant-nopasswd
echo 'Defaults !requiretty' >> /etc/sudoers
sed -i 's/.*UseDNS.*/UseDNS no/' /etc/ssh/sshd_config
cat > /etc/ssh/sshd_config.d/10-vagrant-insecure-rsa-key.conf <<EOF
# For now the vagrant insecure key is an rsa key
# https://github.com/hashicorp/vagrant/issues/11783
PubkeyAcceptedKeyTypes=+ssh-rsa
EOF
ssh-keygen -A
# Create and configure the vagrant user
adduser vagrant -D
# Add the vagrant user to the `wheel` group
addgroup vagrant wheel
[ -d /home/vagrant ] || exit 1
echo "vagrant:vagrant" | chpasswd
echo "root:vagrant" | chpasswd
# Do host-specific things
virt="$(virt-what)"
# Values I've found so far
# "microsoft" == Hyper-V
# "oracle" == VirtualBox
# "KVM" == KVM/Qemu
case "${virt}" in
microsoft | hyperv)
apk add hvtools
rc-update add hv_fcopy_daemon
rc-update add hv_kvp_daemon
rc-update add hv_vss_daemon
target="0001" # Placeholder for now
;;
kvm | qemu)
apk add qemu-guest-agent
rc-update add qemu-guest-agent
target="$(efibootmgr | grep 'Misc' | awk '{print $1}' | sed -E 's/[^0-9]//g')"
;;
virtualbox*)
apk add virtualbox-guest-additions
rc-update add virtualbox-guest-additions boot
target="$(efibootmgr | grep 'VBOX HARD' | awk '{print $1}' | sed -E 's/[^0-9]//g')"
;;
esac
efibootmgr --bootnext "${target}"
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
set -ex
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
set -ex
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
set -ex
pacman -Sy --noconfirm open-vm-tools
+4
View File
@@ -2,4 +2,8 @@
version = "3.19.0";
arch = "amd64";
eol = false;
} {
version = "3.20";
arch = "amd64";
eol = false;
} ]
+3 -3
View File
@@ -1,11 +1,11 @@
distro = "archlinux"
version = "rolling"
iso = {
url = "http://mirror.rackspace.com/archlinux/iso/2024.04.01/archlinux-2024.04.01-x86_64.iso"
checksum = "52aea58f88c9a80afe64f0536da868251ef4878de5a5e0227fcada9f132bd7ab"
url = "http://mirror.rackspace.com/archlinux/iso/2024.06.01/archlinux-2024.06.01-x86_64.iso"
checksum = "4cc7e1c9f4e97b384f0d8731f317b5995bde256fcc17160d32359cab923c5892"
}
boot_command = [
"e<down><down><down><end> net.ifnames=0 biosdevnames=0 console=ttyS0<f10>",
"e<down><down><down><end> net.ifnames=0 biosdevnames=0 <enter>",
"<wait60>", # Wait for system to come up?
"curl -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh<enter>",
"<wait5>",
+1 -1
View File
@@ -24,7 +24,7 @@ boot_command = [
"<up>e<wait>",
"<down><down><end><wait>",
" inst.text inst.ks=cdrom:/ks.cfg",
" inst.notmux console=ttyS0",
" inst.notmux ",
"<leftCtrlOn>x<leftCtrlOff>"
]
cd_files = [ "distros/centos-stream/9/disc/*" ]
+2 -2
View File
@@ -1,14 +1,14 @@
distro = "centos"
version = "7"
iso = {
url = "http://mirror.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-2009.iso"
url = "http://vault.centos.org/centos/7.9.2009/isos/x86_64/CentOS-7-x86_64-NetInstall-2009.iso"
checksum = "b79079ad71cc3c5ceb3561fff348a1b67ee37f71f4cddfec09480d4589c191d6"
}
boot_command = [
"<up>e<wait>",
"<down><down><end><wait>",
" inst.ks=cdrom:/ks.cfg<wait>",
" inst.notmux console=ttyS0",
" inst.notmux ",
"<leftCtrlOn>x<leftCtrlOff>"
]
cd_files = ["distros/centos/7/disc/*"]
+8 -2
View File
@@ -2,8 +2,9 @@ install
text
reboot
network --bootproto=dhcp --activate
url --url=http://mirror.centos.org/centos/7/os/x86_64/
repo --name=updates --baseurl=http://mirror.centos.org/centos/7/updates/x86_64/
url --url=http://vault.centos.org/7.9.2009/os/x86_64/
repo --name=base --baseurl=http://vault.centos.org/7.9.2009/os/x86_64/ --install
repo --name=updates --baseurl=http://vault.centos.org/7.9.2009/updates/x86_64/ --install
lang en_US.UTF-8
keyboard us
timezone --utc Etc/UTC
@@ -42,6 +43,11 @@ nmcli c
%end
%post --erroronfail
echo "gpgkey=https://vault.centos.org/7.9.2009/os/x86_64/RPM-GPG-KEY-CentOS-7" >> /etc/yum.repos.d/base.repo
echo "gpgkey=https://vault.centos.org/7.9.2009/os/x86_64/RPM-GPG-KEY-CentOS-7" >> /etc/yum.repos.d/updates.repo
rm -f /etc/yum.repos.d/CentOS*
yum -y update
cat <<EOF > /etc/sudoers.d/vagrant
-1
View File
@@ -16,7 +16,6 @@ boot_command = [
"debconf/frontend=noninteractive ",
"hostname={{.Name}} ",
"domain=vagrant ",
"console=ttyS0 ",
"<f10>"
]
http_directory = "distros/debian/10/http/"
-1
View File
@@ -16,7 +16,6 @@ boot_command = [
"debconf/frontend=noninteractive ",
"hostname={{.Name}} ",
"domain=vagrant ",
"console=ttyS0 ",
"<f10>"
]
http_directory = "distros/debian/11/http/"
+2 -3
View File
@@ -1,8 +1,8 @@
distro = "debian"
version = "12"
iso = {
url = "http://cdimage.debian.org/cdimage/release/12.5.0/amd64/iso-cd/debian-12.5.0-amd64-netinst.iso"
checksum = "013f5b44670d81280b5b1bc02455842b250df2f0c6763398feb69af1a805a14f"
url = "http://cdimage.debian.org/cdimage/release/12.6.0/amd64/iso-cd/debian-12.6.0-amd64-netinst.iso"
checksum = "ade3a4acc465f59ca2496344aab72455945f3277a52afc5a2cae88cdc370fa12"
}
boot_command = [
"<down>e<wait><down><down><down><end><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
@@ -16,7 +16,6 @@ boot_command = [
"debconf/frontend=noninteractive ",
"hostname={{.Name}} ",
"domain=vagrant ",
"console=ttyS0 ",
"<f10>"
]
http_directory = "distros/debian/12/http/"
+1 -1
View File
@@ -6,7 +6,7 @@ iso = {
}
boot_command = [
"<up>e<down><down><end> ",
"net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/amd64-ks.cfg inst.notmux console=ttyS0<f10>"
"net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/amd64-ks.cfg inst.notmux <f10>"
]
cd_files = [
"distros/fedora/39/*.cfg"
+1 -1
View File
@@ -6,7 +6,7 @@ iso = {
}
boot_command = [
"<up>e<down><down><end> ",
"net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/amd64-ks.cfg inst.notmux console=ttyS0<f10>"
"net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/amd64-ks.cfg inst.notmux <f10>"
]
cd_files = [
"distros/fedora/40/*.cfg"
+1 -1
View File
@@ -35,7 +35,7 @@ iso = {
}
boot_command = [
"<up>e<down><down><end><bs><bs><bs><bs><bs>",
"net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/amd64-ks.cfg inst.notmux console=ttyS0<f10>"
"net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/amd64-ks.cfg inst.notmux <f10>"
]
cd_files = [
"distros/fedora/rawhide/*.cfg"
+41
View File
@@ -0,0 +1,41 @@
#!env bash
set -exo pipefail
# Name of the file to write out
name="${0%.sh}"
version="24.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 = [
"curl -o /tmp/install.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/install.sh<enter>",
"<wait>",
"sudo bash /tmp/install.sh {{ .HTTPPort }} {{ .HTTPIP }}<enter>"
]
http_directory = "distros/nixos/${version}/http/"
boot_wait = "90s"
EOF
rm -r "${tmp}"
rm -f "cache/latest-nixos-minimal-x86_64-linux.iso"
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
set -ex
@@ -0,0 +1,67 @@
{config, pkgs, lib, ...}:
{
imports = [
./hardware-configuration.nix
./guest-agent.nix
];
system.stateVersion = "24.05";
# Packages installed on the whole system
environment.systemPackages = with pkgs; [
curl
nano
python3
];
# Services that are running
services = {
openssh.enable = true;
#xserver.enable = true;
};
# User setup
users.groups.vagrant = {};
users.users.vagrant = {
isNormalUser = true;
group = "vagrant";
extraGroups = [ "wheel" ];
password = "vagrant";
};
security.sudo.extraRules = [
{
users = [ "vagrant" ];
groups = [ "vagrant" ];
commands = [
{ command = "ALL"; options = [ "NOPASSWD" ]; }
];
}
];
boot.loader = {
systemd-boot = {
enable = true;
};
efi.canTouchEfiVariables = true;
};
networking = {
hostName = "vagrant";
networkmanager.enable = true;
#proxy.default = "http://user:password@proxy:port/";
#proxy.noProxy = "127.0.0.1,localhost,internal.domain";
};
time.timeZone = "UTC";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminux16";
keyMap = lib.mkForce "us";
useXkbConfig = true;
};
nix = {
package = pkgs.nixFlakes;
settings = {
experimental-features = "nix-command flakes";
};
};
}
+15
View File
@@ -0,0 +1,15 @@
{
description = "A basic NixOS Vagrant install";
inputs = {
nixstable.url = "github:nixos/nixpkgs/nixos-24.05";
};
outputs = { nixstable, self, ... }@inputs:
{
nixosConfigurations.vagrant = nixstable.lib.nixosSystem {
system = "x86_64-linux";
modules = [ ./configuration.nix ];
};
};
}
+1
View File
@@ -0,0 +1 @@
ga-qemu.nix
@@ -0,0 +1,4 @@
{...}:
{
virtualisation.hypervGuest.enable = true;
}
+6
View File
@@ -0,0 +1,6 @@
{...}:
{
virtualisation.virtualbox.guest = {
enable = true;
};
}
+4
View File
@@ -0,0 +1,4 @@
{...}:
{
services.qemuGuest.enable = true;
}
+7
View File
@@ -0,0 +1,7 @@
{...}:
{
virtualisation.vmware.guest = {
enable = true;
headless = false;
}
}
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -ex
# Set passwords
echo "vagrant:vagrant" | chpasswd
echo "root:vagrant" | chpasswd
# Set ownership of things vagrant should own
chown -R vagrant:vagrant ~vagrant/
chown -R vagrant:wheel /etc/nixos
+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env bash
#vim: set ft=bash:
set -ex
port="${1}" # HTTP port that packer is running on
host="${2}"
if [ -e /dev/vda ]; then
disk="/dev/vda"
elif [ -e /dev/sda ]; then
disk="/dev/sda"
else
exit 1 # Need to teach the script which device to use in this case
fi
# The sed bit is just to strip out the extra fluff, like comments
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk ${disk}
g # create new GPT partition table
n # new
# default partition number
# default start
+512M # size
t # set type
1 # EFI system partition
n # second partition
# default partition number
# start at first free sector
# default to full disk
p # print, for debugging
w # write the partition table and exit
EOF
sleep 10 # Let me at least read it!
#t # set partition type
#1 # on partition 1
#4 # BIOS boot
# Format and mount partitions
mkfs.vfat "${disk}1"
mkfs.ext4 "${disk}2"
mount "${disk}2" /mnt
mkdir -p /mnt/boot
mount "${disk}1" /mnt/boot
# Bootstrap system
virt="$(systemd-detect-virt)"
nixos-generate-config --root /mnt
curl -o /mnt/etc/nixos/configuration.nix "http://${host}:${port}/configuration.nix"
curl -o /mnt/etc/nixos/flake.nix "http://${host}:${port}/flake.nix"
curl -o /mnt/etc/nixos/guest-agent.nix "http://${host}:${port}/ga-${virt}.nix"
sed -i -E -e "s,@BOOT_DEVICE@,${disk}," /mnt/etc/nixos/configuration.nix
nixos-install --no-root-password --flake "/mnt/etc/nixos/#vagrant"
# Run stuff in the chroot
curl -o /mnt/root/in-chroot.sh "http://${host}:${port}/in-chroot.sh"
nixos-enter --root /mnt -c 'bash /root/in-chroot.sh'
rm /mnt/root/in-chroot.sh
umount /mnt/boot
umount /mnt
efibootmgr --bootnext "$(efibootmgr | grep Linux | awk '{print $1}' | sed -E 's/[^0-9]//g')"
reboot
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
set -ex
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
set -ex
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
set -ex
+4
View File
@@ -6,4 +6,8 @@
version = "23.11";
arch = "amd64";
eol = false;
} {
version = "24.05";
arch = "amd64";
eol = false;
} ]
+2 -3
View File
@@ -1,15 +1,14 @@
distro = "opensuse"
version = "15.5"
iso = {
url = "https://download.opensuse.org/distribution/leap/15.5/iso/openSUSE-Leap-15.5-NET-x86_64-Media.iso"
checksum = "a2f7f2f1b6b3d3ef96f5c8f804d87ebd01e5cf982357c533f4c39c33cd20ec56"
url = "http://download.opensuse.org/distribution/leap/15.5/iso/openSUSE-Leap-15.5-DVD-x86_64-Current.iso"
checksum = "53bcbcb82361c5261c9d0994ab0f94101bf28e61c06fe12d320984601be35a8f"
}
boot_command = [
"e<wait>",
"<down><down><down><down><end><wait>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
" autoyast=http://{{ .HTTPIP }}:{{ .HTTPPort }}/autoinst.xml textmode=1<wait>",
" console=ttyS0",
"<leftCtrlOn>x<leftCtrlOff>"
]
http_directory = "distros/opensuse/15.5/http/"
+2 -3
View File
@@ -1,15 +1,14 @@
distro = "opensuse"
version = "15.6"
iso = {
url = "https://download.opensuse.org/distribution/leap/15.6/iso/openSUSE-Leap-15.6-NET-x86_64-Media.iso"
checksum = "4631636c43297951f1a0a3a2a804e30f4bf1790f892d0f0ac46f62ec82ac2075"
url = "https://download.opensuse.org/distribution/leap/15.6/iso/openSUSE-Leap-15.6-DVD-x86_64-Current.iso"
checksum = "a74d4072e639c75ca127df3d869c1e57bcc44a093a969550f348a3ead561fe4f"
}
boot_command = [
"e<wait>",
"<down><down><down><down><end><wait>",
"<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
" autoyast=http://{{ .HTTPIP }}:{{ .HTTPPort }}/autoinst.xml textmode=1<wait>",
" console=ttyS0",
"<leftCtrlOn>x<leftCtrlOff>"
]
http_directory = "distros/opensuse/15.6/http/"
+4
View File
@@ -2,6 +2,10 @@
version = "15.5";
arch = "amd64";
eol = false;
} {
version = "15.6";
arch = "amd64";
eol = false;
} {
version = "tumbleweed";
arch = "amd64";
@@ -26,7 +26,6 @@ boot_command = [
"e<wait>",
"<down><down><down><down><end><wait>",
" autoyast=http://{{ .HTTPIP }}:{{ .HTTPPort }}/autoinst.xml textmode=1<wait>",
" console=ttyS0",
"<leftCtrlOn>x<leftCtrlOff>"
]
http_directory = "distros/opensuse/tumbleweed/http/"
+1 -1
View File
@@ -8,7 +8,7 @@ boot_command = [
"<up>e<wait>",
"<down><down><end><wait>",
" inst.text inst.ks=cdrom:/ks.cfg",
" inst.notmux console=ttyS0",
" inst.notmux ",
"<leftCtrlOn>x<leftCtrlOff>"
]
cd_files = [ "distros/rockylinux/9/disc/*" ]
-1
View File
@@ -7,7 +7,6 @@ iso = {
boot_wait = "3s"
boot_command = [
"e<wait><down><down><down><end><bs><bs><bs>",
"console=ttyS0 ",
"fsck.mode=skip ",
"locale=en_US ",
"auto=true ",
-1
View File
@@ -6,7 +6,6 @@ iso = {
}
boot_command = [
"e<down><down><down><end><bs><bs><bs>",
"console=ttyS0 ",
"fsck.mode=skip ",
"locale=en_US ",
"auto=true ",
-1
View File
@@ -6,7 +6,6 @@ iso = {
}
boot_command = [
"e<down><down><down><end><bs><bs><bs>",
"console=ttyS0 ",
"fsck.mode=skip ",
"locale=en_US ",
"auto=true ",
+19
View File
@@ -0,0 +1,19 @@
distro = "ubuntu"
version = "24.04"
iso = {
url = "http://releases.ubuntu.com/24.04/ubuntu-24.04-live-server-amd64.iso"
checksum = "8762f7e74e4d64d72fceb5f70682e6b069932deedb4949c6975d0f0fe0a91be3"
}
boot_command = [
"e<down><down><down><end><bs><bs><bs>",
"fsck.mode=skip ",
"locale=en_US ",
"auto=true ",
"priority=critical ",
"autoinstall",
"<F10>",
]
cd_files = [
"distros/ubuntu/24.04/disc/*"
]
vbox_os_type = "Ubuntu24_64"
View File
+47
View File
@@ -0,0 +1,47 @@
#cloud-config
# vim: set ft=yaml:
autoinstall:
version: 1
network: # Should disable networking, workaround for unattended-updates failing in install
version: 2
ethernets:
eth0:
match:
name: e*
dhcp4: yes
dhcp6: no
refresh-installer:
update: no
keyboard:
layout: us
toggle: null
variant: ''
locale: en_US.UTF-8
identity:
hostname: vagrant
username: vagrant
password: $6$rounds=4096$mJTRlY/vwPMquLe0$s4Ld3ZnvF.pM86xzbAgQD7Xpi/NMVgyQNb5CEfabFgL6nLRsP56WtwA.o.Jg/xC6HaJmM2p5fCGIo37jmKVRI0
ssh:
install-server: yes
authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
allow-pw: yes
user-data:
disable_root: false
package_update: false
package_upgrade: false
late-commands:
- echo 'Defaults:vagrant !requiretty' > /target/etc/sudoers.d/vagrant
- echo 'vagrant ALL=(ALL) NOPASSWD:ALL' >> /target/etc/sudoers.d/vagrant
- chmod 440 /target/etc/sudoers.d/vagrant
- >-
curtin in-target --target=/target --
bash -c 'if [ "$(systemd-detect-virt)" == "microsoft" ]; then
apt-get update;
apt-get install -y linux-azure;
fi'
- curtin in-target --target=/target -- logger "finished late-commands"
packages:
- ca-certificates
- curl
- sudo
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -ex
apt remove cloud-init -y
apt update
apt upgrade -y
# Make sshd faster
cat << EOF > /etc/ssh/sshd_config.d/00-vagrant_accept_pubkey.conf
UseDNS no
PubkeyAcceptedKeyTypes +ssh-rsa
EOF
# Clean up after ourselves
apt-get clean
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -ex
apt install -y qemu-guest-agent
systemctl start qemu-guest-agent
systemctl enable qemu-guest-agent
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -ex
apt install -y virtualbox-guest-utils
+4
View File
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -ex
apt install -y open-vm-tools
+4
View File
@@ -14,4 +14,8 @@
version = "23.10";
arch = "amd64";
eol = false;
} {
version = "24.04";
arch = "amd64";
eol = false;
} ]
Generated
+3 -3
View File
@@ -100,11 +100,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1718870667,
"narHash": "sha256-jab3Kpc8O1z3qxwVsCMHL4+18n5Wy/HHKyu1fcsF7gs=",
"lastModified": 1720750130,
"narHash": "sha256-y2wc7CdK0vVSIbx7MdVoZzuMcUoLvZXm+pQf2RIr1OU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9b10b8f00cb5494795e5f51b39210fed4d2b0748",
"rev": "6794d064edc69918bb0fc0e0eda33ece324be17a",
"type": "github"
},
"original": {
+22 -17
View File
@@ -30,6 +30,11 @@
name = d: "-${d.distro}-${d.arch}-${d.provider}-${d.version}";
distroFile = d: "distros/${d.distro}/${d.version}/${d.arch}.pkrvars.hcl";
cmd = d: ''
# This is a workaround for a goofy behavior in CI
if [ -e "''${PACKER_CONFIG_DIR}" ]; then
find "''${PACKER_CONFIG_DIR}" -name '*_linux_amd64' -exec chmod +x '{}' ";"
fi
packer init sources
version="''${1:-1}"
packer build -var "build=$version" -only=${d.provider}.${d.arch} -var-file=${distroFile d}'';
in flake-parts.lib.mkFlake { inherit inputs; }
@@ -80,7 +85,10 @@
env = [{
name = "EFI_DIR";
value = "${pkgs.OVMF.fd}/FV/";
}];
} {
name = "PACKER_CONFIG_DIR";
value = "./packer_config";
} ];
};
# This is not special, this is just flakes
@@ -88,6 +96,7 @@
base = {
runtimeInputs = with pkgs; [
packer
findutils
qemu_full
vagrant
];
@@ -105,6 +114,13 @@
vagrant box add --provider ${vp d} ./output/${vp d}/${d.distro}-${d.version}.box --name test_box --force
'';
});
cibuild = d: pkgs.writeShellApplication (base // {
name = "ci${name d}";
text = ''
set -x
${cmd d} -except=upload sources/
'';
});
upload = d: pkgs.writeShellApplication (base // {
name = "upload${name d}";
text = ''
@@ -114,15 +130,17 @@
});
builds = lib.lists.foldr (d: acc: acc // { "build${name d}" = (build d); }) {} withProviders;
uploads = lib.lists.foldr (d: acc: acc // { "upload${name d}" = (upload d); }) {} withProviders;
qemu_list = builtins.toJSON (builtins.map (d: { distro = distroFile d; }) (builtins.filter (x: x.provider == "qemu") active));
vbox_list = builtins.toJSON (builtins.map (d: { distro = distroFile d; }) (builtins.filter (x: x.provider == "virtualbox-iso") active));
cibuilds = lib.lists.foldr (d: acc: acc // { "ci${name d}" = (cibuild d); }) {} withProviders;
qemu_list = builtins.toJSON (builtins.map (d: { buildcmd = "ci${name d}"; }) (builtins.filter (x: x.provider == "qemu") active));
vbox_list = builtins.toJSON (builtins.map (d: { buildcmd = "ci${name d}"; }) (builtins.filter (x: x.provider == "virtualbox-iso") active));
hyperv_list = builtins.toJSON (builtins.map (d: { distro = distroFile d; }) (builtins.filter (x: x.provider == "hyperv-iso") active));
in builds // uploads // {
in builds // uploads // cibuilds // {
continue = pkgs.writeText "continue.yml"
(builtins.replaceStrings ["QEMU_MATRIX" "VBOX_MATRIX" "HYPERV_MATRIX"] [qemu_list vbox_list hyperv_list]
(builtins.readFile ./.gitlab-ci-build.yml.in)
);
cache = pkgs.callPackage (import ./nix/cache.nix) { inherit active distroFile; };
validate = pkgs.callPackage (import ./nix/validate.nix) {};
cache-restore = pkgs.writeShellApplication {
name = "cache-restore";
runtimeInputs = with pkgs; [
@@ -161,19 +179,6 @@
shellcheck -e SC2239 "''${scripts[@]}"
'';
};
validate = pkgs.writeShellApplication {
name = "validate";
runtimeInputs = with pkgs; [
packer
];
text = ''
shopt -s globstar
packer init sources
for vars in distros/**/*.pkrvars.hcl; do
packer validate -except=upload "-var-file=''${vars}" sources/
done
'';
};
};
# https://numtide.github.io/treefmt/
+3 -2
View File
@@ -29,11 +29,12 @@ in writeShellApplication {
map (d: ''
url=$(echo var.iso.url | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/)
sha=$(echo var.iso.checksum | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/)
distro=$(echo var.distro | packer console -var-file="${distroFile d}" -config-type=hcl2 sources/)
# shellcheck disable=SC2143
if [ -z "$(mc ls storage/isos/cache/ | grep "$sha")" ]; then
if [ -z "$(mc ls "storage/isos/cache/$distro" | grep "$sha")" ]; then
curl -L --retry 3 --retry-all-errors -o "cache/$sha.iso" "$url"
if [ "$push" == "yes" ]; then
mc put "cache/$sha.iso" "storage/isos/cache/$sha.iso"
mc put "cache/$sha.iso" "storage/isos/cache/$distro/$sha.iso"
fi
else
echo "Skipping ${d.distro} - cache/$sha.iso"
+21
View File
@@ -0,0 +1,21 @@
{
writeShellApplication,
findutils,
packer,
...
}:
writeShellApplication {
name = "validate";
runtimeInputs = [
findutils
packer
];
text = ''
shopt -s globstar
find "''${PACKER_CONFIG_DIR}" -name '*_linux_amd64' -exec chmod +x '{}' ";"
packer init sources
for vars in distros/**/*.pkrvars.hcl; do
packer validate -except=upload "-var-file=''${vars}" sources/
done
'';
}
+2 -2
View File
@@ -2,11 +2,11 @@ packer {
required_plugins {
qemu = {
source = "github.com/hashicorp/qemu"
version = "= 1.0.10"
version = "= 1.1.0"
}
vagrant = {
source = "github.com/hashicorp/vagrant"
version = "= 1.1.1"
version = "= 1.1.4"
}
vmware = {
version = "= 1.0.11"
+1 -1
View File
@@ -1,5 +1,5 @@
source "hyperv-iso" "amd64" {
iso_urls = [ "s3::${var.storage_url}/isos/cache/${var.iso.checksum}.iso?aws_access_key_id=root&aws_access_key_secret=${var.minio_secret}" ]
iso_urls = [ local.iso_location ]
iso_target_path = "cache/${var.iso.checksum}.iso"
iso_checksum = var.iso.checksum
output_directory = "output/hyperv/${local.name}"
+1
View File
@@ -127,6 +127,7 @@ locals {
version = var.version
build = var.build
})
iso_location = "s3::${var.storage_url}/isos/cache/${var.distro}/${var.iso.checksum}.iso?aws_access_key_id=root&aws_access_key_secret=${var.minio_secret}"
cpus = var.cpus
memory = var.memory
+1 -1
View File
@@ -4,7 +4,7 @@ variable "qemu_accelerator" {
}
source "qemu" "amd64" {
iso_urls = [ "s3::${var.storage_url}/isos/cache/${var.iso.checksum}.iso?aws_access_key_id=root&aws_access_key_secret=${var.minio_secret}" ]
iso_urls = [ local.iso_location ]
iso_target_path = "cache/${var.iso.checksum}.iso"
iso_checksum = var.iso.checksum
output_directory = "output/libvirt/${local.name}"
+1 -1
View File
@@ -1,5 +1,5 @@
source "virtualbox-iso" "amd64" {
iso_urls = [ "s3::${var.storage_url}/isos/cache/${var.iso.checksum}.iso?aws_access_key_id=root&aws_access_key_secret=${var.minio_secret}" ]
iso_urls = [ local.iso_location ]
iso_target_path = "cache/${var.iso.checksum}.iso"
iso_checksum = var.iso.checksum
output_directory = "output/virtualbox/${local.name}"