Archived
Check NixOS configurations / eval-hosts (pull_request) Successful in 10m42s
The iPXE menu's "nixos" entry actually chain-loads this flake's own custom auto-installer image, not a stock NixOS image — rename it to "auto-installer" (label "NixOS Auto-Installer") so the menu says what it boots, and set networking.hostName on netbootSystem to match, so the generated system name (nixos-system-auto-installer-*) and staged directory (/srv/pxe/http/auto-installer) agree with the menu entry too. Add a second, genuinely vanilla NixOS minimal netboot image (netbootMinimalSystem in flake.nix — nixpkgs' netboot-minimal.nix on its own, none of modules/installer/common.nix's auto-installer wiring), built from source the same way as the auto-installer image and exposed as packages.x86_64-linux.pxe-minimal. Staged and menu-wired the same way, as "nixos-minimal" (item, hostname, and directory all matching). modules/pxe-boot/stage-installer-artifacts.nix is generalized to stage both images via a shared rule-builder instead of one hardcoded set of paths. Verified: nix eval confirms both images' config.system.name matches their menu entry/directory names, the pxe-boot host itself builds clean with the new menu.ipxe, and the new pxe-minimal image was booted directly under QEMU (kernel+initrd, no KVM) to a working login shell with hostname nixos-minimal, no hang.
33 lines
1.5 KiB
Nix
33 lines
1.5 KiB
Nix
{ netbootSystem, netbootMinimalSystem, ... }:
|
|
|
|
let
|
|
# config.system.build.kernel and .netbootRamdisk are directories, not the
|
|
# files themselves — nixpkgs' own system.build.kexecTree does the same
|
|
# ${...}/<file> dereference for the same reason.
|
|
mkStageRules = { dirName, system }:
|
|
let
|
|
inherit (system.config.system.boot.loader) kernelFile;
|
|
dir = "/srv/pxe/http/${dirName}";
|
|
in
|
|
[
|
|
# Declared here too (not just in build-types/pxe-boot.nix) so this
|
|
# module's C+ rules don't depend on cross-module list-merge ordering —
|
|
# tmpfiles' C type needs the target directory to already exist.
|
|
"d ${dir} 0755 root root -"
|
|
"C+ ${dir}/${kernelFile} 0644 root root - ${system.config.system.build.kernel}/${kernelFile}"
|
|
"C+ ${dir}/initrd 0644 root root - ${system.config.system.build.netbootRamdisk}/initrd"
|
|
"C+ ${dir}/netboot.ipxe 0644 root root - ${system.config.system.build.netbootIpxeScript}/netboot.ipxe"
|
|
];
|
|
in
|
|
{
|
|
# Builds this flake's own installer netboot image (the same one
|
|
# `nix build .#pxe` produces) plus the vanilla NixOS minimal netboot image
|
|
# (`nix build .#pxe-minimal`), and stages both where menu.ipxe's
|
|
# :auto-installer / :nixos-minimal entries expect them, so the pxe-boot
|
|
# host is self-contained — no manual operator step to populate
|
|
# /srv/pxe/http after deploy.
|
|
systemd.tmpfiles.rules =
|
|
mkStageRules { dirName = "auto-installer"; system = netbootSystem; }
|
|
++ mkStageRules { dirName = "nixos-minimal"; system = netbootMinimalSystem; };
|
|
}
|