From 99eda3fd3fe8c31f2122185e144065fb185d6346 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 20 May 2025 09:32:53 -0500 Subject: [PATCH 1/3] Add Fedora 42 and Ubuntu 25.05 --- distros/fedora/42/amd64-ks.cfg | 181 +++++++++++++++++++++++++ distros/fedora/42/amd64.pkrvars.hcl | 14 ++ distros/fedora/42/finalize.sh | 6 + distros/fedora/42/qemu.sh | 6 + distros/fedora/42/virtualbox.sh | 6 + distros/fedora/42/vmware.sh | 4 + distros/fedora/default.nix | 7 +- distros/ubuntu/25.04/amd64.pkrvars.hcl | 19 +++ distros/ubuntu/25.04/disc/meta-data | 0 distros/ubuntu/25.04/disc/user-data | 47 +++++++ distros/ubuntu/25.04/finalize.sh | 16 +++ distros/ubuntu/25.04/qemu.sh | 6 + distros/ubuntu/25.04/virtualbox.sh | 4 + distros/ubuntu/25.04/vmware.sh | 4 + distros/ubuntu/default.nix | 5 + 15 files changed, 324 insertions(+), 1 deletion(-) create mode 100644 distros/fedora/42/amd64-ks.cfg create mode 100644 distros/fedora/42/amd64.pkrvars.hcl create mode 100644 distros/fedora/42/finalize.sh create mode 100644 distros/fedora/42/qemu.sh create mode 100644 distros/fedora/42/virtualbox.sh create mode 100644 distros/fedora/42/vmware.sh create mode 100644 distros/ubuntu/25.04/amd64.pkrvars.hcl create mode 100644 distros/ubuntu/25.04/disc/meta-data create mode 100644 distros/ubuntu/25.04/disc/user-data create mode 100644 distros/ubuntu/25.04/finalize.sh create mode 100644 distros/ubuntu/25.04/qemu.sh create mode 100644 distros/ubuntu/25.04/virtualbox.sh create mode 100644 distros/ubuntu/25.04/vmware.sh diff --git a/distros/fedora/42/amd64-ks.cfg b/distros/fedora/42/amd64-ks.cfg new file mode 100644 index 0000000..af8a3b4 --- /dev/null +++ b/distros/fedora/42/amd64-ks.cfg @@ -0,0 +1,181 @@ +user --name=vagrant --password=vagrant +rootpw --plaintext vagrant + +text # don't use cmdline -- https://github.com/rhinstaller/anaconda/issues/931 +lang en_US.UTF-8 +keyboard us +timezone --utc Etc/UTC + +selinux --enforcing + +firewall --disabled + +# We pass net.ifnames=0 because we always want to use eth0 here on all the cloud images. +bootloader --timeout=1 --location=mbr --append="no_timer_check net.ifnames=0 console=tty1 console=ttyS0,115200n8 biosdevnames=0" + +services --enabled=sshd + +# Configure for gpt with bios+uefi +clearpart --all --initlabel --disklabel=gpt +part prepboot --size=4 --fstype=prepboot +part biosboot --size=1 --fstype=biosboot +part /boot/efi --size=100 --fstype=efi +part /boot --size=1000 --fstype=ext4 --label=boot +part btrfs.007 --size=2000 --fstype=btrfs --grow +btrfs none --label=fedora btrfs.007 +btrfs /home --subvol --name=home LABEL=fedora +btrfs / --subvol --name=root LABEL=fedora + +repo --name=fedora --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch +repo --name=updates --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch +url --mirrorlist=https://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch + +reboot + +##### begin package list ############################################# +%packages --instLangs=en + +# Include packages for the cloud-server-environment group +@^cloud-server-environment + +# Install the tracer dnf plugin to enable automatic reboots +# IF the user requests package updates +# AND requests a reboot +# AND the packages updated require a reboot. +# https://fedoraproject.org/wiki/Changes/Automatic_Cloud_Reboot_On_Updates +python3-dnf-plugin-tracer + +# Don't include the kernel toplevel package since it pulls in +# kernel-modules. We're happy for now with kernel-core. +-kernel +kernel-core + +# Don't include dracut-config-rescue. It will have dracut generate a +# "rescue" entry in the grub menu, but that also means there is a +# rescue kernel and initramfs that get created, which (currently) add +# about another 40MiB to the /boot/ partition. Also the "rescue" mode +# is generally not useful in the cloud. +-dracut-config-rescue + +# Plymouth provides a graphical boot animation. In the cloud we don't +# need a graphical boot animation. This also means anaconda won't put +# rhgb/quiet on kernel command line +-plymouth + +# Install qemu-guest-agent https://pagure.io/cloud-sig/issue/319 To +# improve the integration with OpenStack and other VM management +# systems (oVirt, KubeVirt). +qemu-guest-agent + + +# No need for firewalld for now. We don't have a firewall on by default. +-firewalld + +# Don't include the geolite2 databases, which end up with 66MiB +# in /usr/share/GeoIP +-geolite2-country +-geolite2-city + +# Specific to vagrant +rsync +fuse-sshfs +%end +##### end package list ############################################### + + +##### begin kickstart post ########################################### +%post --erroronfail +#!/bin/bash +set -x +if [ -e /dev/vda ]; then + device="/dev/vda" +elif [ -e /dev/sda ]; then + device="/dev/sda" +else + echo "No device found" + exit 1 +fi + +virt="$(systemd-detect-virt)" +if [ "${virt}" == "microsoft" ]; then + dnf install -y hyperv-daemons + systemctl enable hpervfcopyd + systemctl enable hypervkvpd + systemctl enable hypervvssd +fi + +if [ "$(arch)" = "x86_64" ]; then +# Set up legacy BIOS boot if we booted from UEFI +grub2-install --target=i386-pc "${device}" +fi + +# Blivet sets pmbr_boot flag erroneously and we need to purge it +# otherwise it'll fail to boot +parted "${device}" disk_set pmbr_boot off + +# linux-firmware is installed by default and is quite large. As of mid 2020: +# Total download size: 97 M +# Installed size: 268 M +# So far we've been fine shipping without it so let's continue. +# More discussion about this in #1234504. +echo "Removing linux-firmware package." +rpm -e linux-firmware + +# See the systemd-random-seed.service man page that says: +# " It is recommended to remove the random seed from OS images intended +# for replication on multiple systems" +echo "Removing random-seed so it's not the same in every image." +rm -f /var/lib/systemd/random-seed + +echo "Import RPM GPG key" +releasever=$(rpm --eval '%{fedora}') +basearch=$(uname -i) +rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch + +echo "Zeroing out empty space." +# Create zeros file with nodatacow and no compression +touch /var/tmp/zeros +chattr +C /var/tmp/zeros +# This forces the filesystem to reclaim space from deleted files +dd bs=1M if=/dev/zero of=/var/tmp/zeros || : +echo "(Don't worry -- that out-of-space error was expected.)" +# Force sync to disk (Cf. https://pagure.io/cloud-sig/issue/340#comment-743430) +btrfs filesystem sync / +rm -f /var/tmp/zeros +btrfs filesystem sync / + +# When we build the image a networking config file gets left behind. +# Let's clean it up. +echo "Cleanup leftover networking configuration" +rm -f /etc/NetworkManager/system-connections/*.nmconnection +#*/ + +# Truncate the /etc/resolv.conf left over from NetworkManager during the +# kickstart. This causes delays in boot with cloud-init because the +# 192.168.122.1 DNS server cannot be reached. +truncate -s 0 /etc/resolv.conf + +# Clear machine-id on pre generated images +truncate -s 0 /etc/machine-id + +# Vagrant setup +sed -i 's,Defaults\\s*requiretty,Defaults !requiretty,' /etc/sudoers +echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant-nopasswd +sed -i 's/.*UseDNS.*/UseDNS no/' /etc/ssh/sshd_config + +cat > /etc/ssh/sshd_config.d/10-vagrant-insecure-rsa-key.conf <e ", + "net.ifnames=0 biosdevnames=0 inst.ks=cdrom:/amd64-ks.cfg inst.notmux " +] +cd_files = [ + "distros/fedora/42/*.cfg" +] +vbox_os_type = "Fedora_64" diff --git a/distros/fedora/42/finalize.sh b/distros/fedora/42/finalize.sh new file mode 100644 index 0000000..c30e5a8 --- /dev/null +++ b/distros/fedora/42/finalize.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -ex + +dnf -y update + +dnf clean all diff --git a/distros/fedora/42/qemu.sh b/distros/fedora/42/qemu.sh new file mode 100644 index 0000000..569dc7c --- /dev/null +++ b/distros/fedora/42/qemu.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -ex + +dnf install -y qemu-guest-agent +systemctl start qemu-guest-agent +systemctl enable qemu-guest-agent diff --git a/distros/fedora/42/virtualbox.sh b/distros/fedora/42/virtualbox.sh new file mode 100644 index 0000000..209dab5 --- /dev/null +++ b/distros/fedora/42/virtualbox.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -ex + +dnf install -y virtualbox-guest-additions +systemctl start vboxservice +systemctl enable vboxservice diff --git a/distros/fedora/42/vmware.sh b/distros/fedora/42/vmware.sh new file mode 100644 index 0000000..058afc2 --- /dev/null +++ b/distros/fedora/42/vmware.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -ex + +dnf install -y open-vm-tools diff --git a/distros/fedora/default.nix b/distros/fedora/default.nix index 153304f..cb6c4fa 100644 --- a/distros/fedora/default.nix +++ b/distros/fedora/default.nix @@ -17,13 +17,18 @@ { version = "40"; arch = "amd64"; - eol = false; + eol = true; } { version = "41"; arch = "amd64"; eol = false; } + { + version = "42"; + arch = "amd64"; + eol = false; + } { version = "rawhide"; arch = "amd64"; diff --git a/distros/ubuntu/25.04/amd64.pkrvars.hcl b/distros/ubuntu/25.04/amd64.pkrvars.hcl new file mode 100644 index 0000000..cd96b3f --- /dev/null +++ b/distros/ubuntu/25.04/amd64.pkrvars.hcl @@ -0,0 +1,19 @@ +distro = "ubuntu" +version = "25.04" +iso = { + url = "https://releases.ubuntu.com/25.04/ubuntu-25.04-live-server-amd64.iso" + checksum = "8b44046211118639c673335a80359f4b3f0d9e52c33fe61c59072b1b61bdecc5" +} +boot_command = [ + "e", + "fsck.mode=skip ", + "locale=en_US ", + "auto=true ", + "priority=critical ", + "autoinstall", + "", +] +cd_files = [ + "distros/ubuntu/25.04/disc/*" +] +vbox_os_type = "Ubuntu_64" diff --git a/distros/ubuntu/25.04/disc/meta-data b/distros/ubuntu/25.04/disc/meta-data new file mode 100644 index 0000000..e69de29 diff --git a/distros/ubuntu/25.04/disc/user-data b/distros/ubuntu/25.04/disc/user-data new file mode 100644 index 0000000..4b96996 --- /dev/null +++ b/distros/ubuntu/25.04/disc/user-data @@ -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 diff --git a/distros/ubuntu/25.04/finalize.sh b/distros/ubuntu/25.04/finalize.sh new file mode 100644 index 0000000..f79a717 --- /dev/null +++ b/distros/ubuntu/25.04/finalize.sh @@ -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 diff --git a/distros/ubuntu/25.04/qemu.sh b/distros/ubuntu/25.04/qemu.sh new file mode 100644 index 0000000..4ef2dee --- /dev/null +++ b/distros/ubuntu/25.04/qemu.sh @@ -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 diff --git a/distros/ubuntu/25.04/virtualbox.sh b/distros/ubuntu/25.04/virtualbox.sh new file mode 100644 index 0000000..2813d68 --- /dev/null +++ b/distros/ubuntu/25.04/virtualbox.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -ex + +apt install -y virtualbox-guest-utils diff --git a/distros/ubuntu/25.04/vmware.sh b/distros/ubuntu/25.04/vmware.sh new file mode 100644 index 0000000..9560300 --- /dev/null +++ b/distros/ubuntu/25.04/vmware.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -ex + +apt install -y open-vm-tools diff --git a/distros/ubuntu/default.nix b/distros/ubuntu/default.nix index deb0257..f134b5e 100644 --- a/distros/ubuntu/default.nix +++ b/distros/ubuntu/default.nix @@ -27,6 +27,11 @@ { version = "24.10"; arch = "amd64"; + eol = true; + } + { + version = "25.04"; + arch = "amd64"; eol = false; } ] From 0a78f250d7a81d8e94b37583338756e65c1462ca Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Tue, 20 May 2025 20:51:38 -0500 Subject: [PATCH 2/3] Add Nix 25.05 --- distros/nixos/25.05/amd64.pkrvars.hcl.sh | 41 ++++++++++++ distros/nixos/25.05/finalize.sh | 2 + distros/nixos/25.05/http/configuration.nix | 73 ++++++++++++++++++++++ distros/nixos/25.05/http/flake.nix | 16 +++++ distros/nixos/25.05/http/ga-kvm.nix | 4 ++ distros/nixos/25.05/http/ga-microsoft.nix | 4 ++ distros/nixos/25.05/http/ga-oracle.nix | 6 ++ distros/nixos/25.05/http/ga-qemu.nix | 4 ++ distros/nixos/25.05/http/ga-vmware.nix | 7 +++ distros/nixos/25.05/http/in-chroot.sh | 10 +++ distros/nixos/25.05/http/install.sh | 64 +++++++++++++++++++ distros/nixos/25.05/qemu.sh | 2 + distros/nixos/25.05/virtualbox.sh | 2 + distros/nixos/25.05/vmware.sh | 2 + distros/nixos/default.nix | 7 ++- 15 files changed, 243 insertions(+), 1 deletion(-) create mode 100755 distros/nixos/25.05/amd64.pkrvars.hcl.sh create mode 100644 distros/nixos/25.05/finalize.sh create mode 100644 distros/nixos/25.05/http/configuration.nix create mode 100644 distros/nixos/25.05/http/flake.nix create mode 100644 distros/nixos/25.05/http/ga-kvm.nix create mode 100644 distros/nixos/25.05/http/ga-microsoft.nix create mode 100644 distros/nixos/25.05/http/ga-oracle.nix create mode 100644 distros/nixos/25.05/http/ga-qemu.nix create mode 100644 distros/nixos/25.05/http/ga-vmware.nix create mode 100644 distros/nixos/25.05/http/in-chroot.sh create mode 100644 distros/nixos/25.05/http/install.sh create mode 100644 distros/nixos/25.05/qemu.sh create mode 100644 distros/nixos/25.05/virtualbox.sh create mode 100644 distros/nixos/25.05/vmware.sh diff --git a/distros/nixos/25.05/amd64.pkrvars.hcl.sh b/distros/nixos/25.05/amd64.pkrvars.hcl.sh new file mode 100755 index 0000000..7e3c3eb --- /dev/null +++ b/distros/nixos/25.05/amd64.pkrvars.hcl.sh @@ -0,0 +1,41 @@ +#!env bash +set -exo pipefail + +# Name of the file to write out +name="${0%.sh}" + +version="25.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", + "", + "sudo bash /tmp/install.sh {{ .HTTPPort }} {{ .HTTPIP }}" +] +http_directory = "distros/nixos/${version}/http/" +boot_wait = "90s" +EOF + +rm -r "${tmp}" +rm -f "cache/latest-nixos-minimal-x86_64-linux.iso" diff --git a/distros/nixos/25.05/finalize.sh b/distros/nixos/25.05/finalize.sh new file mode 100644 index 0000000..4cfad53 --- /dev/null +++ b/distros/nixos/25.05/finalize.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +set -ex diff --git a/distros/nixos/25.05/http/configuration.nix b/distros/nixos/25.05/http/configuration.nix new file mode 100644 index 0000000..192cad6 --- /dev/null +++ b/distros/nixos/25.05/http/configuration.nix @@ -0,0 +1,73 @@ +{ + pkgs, + lib, + ... +}: + +{ + imports = [ + ./hardware-configuration.nix + ./guest-agent.nix + ]; + + system.stateVersion = "24.11"; + + # 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 = { + settings = { + experimental-features = "nix-command flakes"; + }; + }; +} diff --git a/distros/nixos/25.05/http/flake.nix b/distros/nixos/25.05/http/flake.nix new file mode 100644 index 0000000..6fa6c5d --- /dev/null +++ b/distros/nixos/25.05/http/flake.nix @@ -0,0 +1,16 @@ +{ + description = "A basic NixOS Vagrant install"; + + inputs = { + nixstable.url = "github:nixos/nixpkgs/nixos-25.05"; + }; + + outputs = + { nixstable, ... }: + { + nixosConfigurations.vagrant = nixstable.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ ./configuration.nix ]; + }; + }; +} diff --git a/distros/nixos/25.05/http/ga-kvm.nix b/distros/nixos/25.05/http/ga-kvm.nix new file mode 100644 index 0000000..65105c0 --- /dev/null +++ b/distros/nixos/25.05/http/ga-kvm.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + services.qemuGuest.enable = true; +} diff --git a/distros/nixos/25.05/http/ga-microsoft.nix b/distros/nixos/25.05/http/ga-microsoft.nix new file mode 100644 index 0000000..f924009 --- /dev/null +++ b/distros/nixos/25.05/http/ga-microsoft.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + virtualisation.hypervGuest.enable = true; +} diff --git a/distros/nixos/25.05/http/ga-oracle.nix b/distros/nixos/25.05/http/ga-oracle.nix new file mode 100644 index 0000000..e274dac --- /dev/null +++ b/distros/nixos/25.05/http/ga-oracle.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + virtualisation.virtualbox.guest = { + enable = true; + }; +} diff --git a/distros/nixos/25.05/http/ga-qemu.nix b/distros/nixos/25.05/http/ga-qemu.nix new file mode 100644 index 0000000..65105c0 --- /dev/null +++ b/distros/nixos/25.05/http/ga-qemu.nix @@ -0,0 +1,4 @@ +{ ... }: +{ + services.qemuGuest.enable = true; +} diff --git a/distros/nixos/25.05/http/ga-vmware.nix b/distros/nixos/25.05/http/ga-vmware.nix new file mode 100644 index 0000000..dbedb7d --- /dev/null +++ b/distros/nixos/25.05/http/ga-vmware.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + virtualisation.vmware.guest = { + enable = true; + headless = false; + }; +} diff --git a/distros/nixos/25.05/http/in-chroot.sh b/distros/nixos/25.05/http/in-chroot.sh new file mode 100644 index 0000000..60c21f1 --- /dev/null +++ b/distros/nixos/25.05/http/in-chroot.sh @@ -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 diff --git a/distros/nixos/25.05/http/install.sh b/distros/nixos/25.05/http/install.sh new file mode 100644 index 0000000..0afef82 --- /dev/null +++ b/distros/nixos/25.05/http/install.sh @@ -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 diff --git a/distros/nixos/25.05/qemu.sh b/distros/nixos/25.05/qemu.sh new file mode 100644 index 0000000..4cfad53 --- /dev/null +++ b/distros/nixos/25.05/qemu.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +set -ex diff --git a/distros/nixos/25.05/virtualbox.sh b/distros/nixos/25.05/virtualbox.sh new file mode 100644 index 0000000..4cfad53 --- /dev/null +++ b/distros/nixos/25.05/virtualbox.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +set -ex diff --git a/distros/nixos/25.05/vmware.sh b/distros/nixos/25.05/vmware.sh new file mode 100644 index 0000000..4cfad53 --- /dev/null +++ b/distros/nixos/25.05/vmware.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +set -ex diff --git a/distros/nixos/default.nix b/distros/nixos/default.nix index fd22de0..526d7f1 100644 --- a/distros/nixos/default.nix +++ b/distros/nixos/default.nix @@ -12,11 +12,16 @@ { version = "24.05"; arch = "amd64"; - eol = false; + eol = true; } { version = "24.11"; arch = "amd64"; + eol = true; + } + { + version = "25.05"; + arch = "amd64"; eol = false; } ] From c5bb96eccc4b1ec7730a6f6093fff43530e4bf28 Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Wed, 21 May 2025 22:21:59 -0500 Subject: [PATCH 3/3] Bump versions for Alma, Arch, Debian, and suse --- distros/almalinux/9/amd64.pkrvars.hcl | 4 ++-- distros/archlinux/rolling/amd64.pkrvars.hcl | 4 ++-- distros/debian/12/amd64.pkrvars.hcl | 4 ++-- distros/opensuse/16.0/amd64.pkrvars.hcl | 4 ++-- distros/opensuse/default.nix | 2 +- flake.nix | 1 + 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/distros/almalinux/9/amd64.pkrvars.hcl b/distros/almalinux/9/amd64.pkrvars.hcl index 3e9bc6c..477d05b 100644 --- a/distros/almalinux/9/amd64.pkrvars.hcl +++ b/distros/almalinux/9/amd64.pkrvars.hcl @@ -1,8 +1,8 @@ distro = "almalinux" version = "9" iso = { - url = "https://mirrors.kernel.org/almalinux/9.5/isos/x86_64/AlmaLinux-9.5-x86_64-boot.iso" - checksum = "3038fb71a29d33c3c93117bd8f4c3f612cb152dce057c666b6b11dfa793fb65c" + url = "https://mirrors.kernel.org/almalinux/9.6/isos/x86_64/AlmaLinux-9.6-x86_64-boot.iso" + checksum = "113521ec7f28aa4ab71ba4e5896719da69a0cc46cf341c4ebbd215877214f661" } boot_command = [ "e", diff --git a/distros/archlinux/rolling/amd64.pkrvars.hcl b/distros/archlinux/rolling/amd64.pkrvars.hcl index a067582..43412f0 100644 --- a/distros/archlinux/rolling/amd64.pkrvars.hcl +++ b/distros/archlinux/rolling/amd64.pkrvars.hcl @@ -1,8 +1,8 @@ distro = "archlinux" version = "rolling" iso = { - url = "https://mirror.rackspace.com/archlinux/iso/2025.03.01/archlinux-2025.03.01-x86_64.iso" - checksum = "8150e3c1a479de9134baa13cea4ff78856cca5ebeb9bdfa87ecfce2e47ac9b5b" + url = "https://mirror.rackspace.com/archlinux/iso/2025.05.01/archlinux-2025.05.01-x86_64.iso" + checksum = "2008e6becc86d207272625c94a388d2ee3b14d6a24b401552d8105c4e82c96db" } boot_command = [ "e net.ifnames=0 biosdevnames=0 ", diff --git a/distros/debian/12/amd64.pkrvars.hcl b/distros/debian/12/amd64.pkrvars.hcl index ab6e5f7..61f00ce 100644 --- a/distros/debian/12/amd64.pkrvars.hcl +++ b/distros/debian/12/amd64.pkrvars.hcl @@ -1,8 +1,8 @@ distro = "debian" version = "12" iso = { - url = "https://cdimage.debian.org/cdimage/release/12.10.0/amd64/iso-cd/debian-12.10.0-amd64-netinst.iso" - checksum = "ee8d8579128977d7dc39d48f43aec5ab06b7f09e1f40a9d98f2a9d149221704a" + url = "https://cdimage.debian.org/cdimage/release/12.11.0/arm64/iso-cd/debian-12.11.0-arm64-netinst.iso" + checksum = "5c050c495770ee9b076261cb8025a99a4866a15a4e3cdab2f59c49e8f69fb0ee" } boot_command = [ "e", diff --git a/distros/opensuse/16.0/amd64.pkrvars.hcl b/distros/opensuse/16.0/amd64.pkrvars.hcl index ca2747b..a169680 100644 --- a/distros/opensuse/16.0/amd64.pkrvars.hcl +++ b/distros/opensuse/16.0/amd64.pkrvars.hcl @@ -1,8 +1,8 @@ distro = "opensuse" version = "16.0" iso = { - url = "https://download.opensuse.org/distribution/leap/16.0/installer/iso/agama-installer-Leap.x86_64-16.0.0-Leap-Build105.1.iso" - checksum = "63784c9b201704cfc146065b24bbc7df082f2891f6ab6a5457753aa2fc1dbe26" + url = "https://download.opensuse.org/distribution/leap/16.0/installer/iso/agama-installer-Leap.x86_64-16.0.0-Leap-Build120.5.iso" + checksum = "9da557e454a5cfb9aad8e1385de0003efd9bd4531e08459385f1169b3c0bfd25" } boot_command = [ "e", diff --git a/distros/opensuse/default.nix b/distros/opensuse/default.nix index a178663..d155756 100644 --- a/distros/opensuse/default.nix +++ b/distros/opensuse/default.nix @@ -12,7 +12,7 @@ { version = "16.0"; arch = "amd64"; - eol = false; # Not yet released, and bugged at the moment + eol = false; } { version = "tumbleweed"; diff --git a/flake.nix b/flake.nix index f46e1bb..0f6aced 100644 --- a/flake.nix +++ b/flake.nix @@ -63,6 +63,7 @@ packages = (with pkgs; [ + packer vagrant ]) ++ (with self'.packages; [