created pxe-boot configuration
Check NixOS configurations / eval-hosts (push) Successful in 32m25s

This commit is contained in:
2026-06-01 17:34:51 +10:00
parent 7b945ea4fe
commit bf0445ebd6
2 changed files with 94 additions and 0 deletions
+81
View File
@@ -0,0 +1,81 @@
{ config, lib, pkgs, inputs, ... }:
let
pxeRoot = "/srv/pxe";
pxeBaseUrl = "http://pxe-boot";
menuIpxe = pkgs.writeText "menu.ipxe" ''
#!ipxe
set base ${pxeBaseUrl}
menu PXE Boot Menu
item nixos NixOS Installer
item rescue Rescue Environment
item shell iPXE Shell
item reboot Reboot
choose target && goto ''${target}
:nixos
kernel ''${base}/nixos/bzImage ip=dhcp
initrd ''${base}/nixos/initrd
boot
:rescue
kernel ''${base}/rescue/vmlinuz ip=dhcp
initrd ''${base}/rescue/initrd
boot
:shell
shell
:reboot
reboot
'';
in
{
imports =
[
../../common/configuration.nix
../../modules/nix/cache-client.nix
../../modules/nix/remote-builder-client.nix
];
networking.hostName = "pxe-boot";
environment.systemPackages = with pkgs; [
ipxe
];
services.nginx = {
enable = true;
virtualHosts."pxe-boot" = {
default = true;
root = pxeRoot;
locations."/" = {
extraConfig = ''
autoindex on;
'';
};
};
};
systemd.tmpfiles.rules = [
"d ${pxeRoot} 0755 root root -"
"d ${pxeRoot}/boot 0755 root root -"
"d ${pxeRoot}/nixos 0755 root root -"
"d ${pxeRoot}/ubuntu 0755 root root -"
"d ${pxeRoot}/rescue 0755 root root -"
"C+ ${pxeRoot}/boot/menu.ipxe 0644 root root - ${menuIpxe}"
"C+ ${pxeRoot}/boot/ipxe.efi 0644 root root - ${pkgs.ipxe}/ipxe.efi"
"C+ ${pxeRoot}/boot/undionly.kpxe 0644 root root - ${pkgs.ipxe}/undionly.kpxe"
];
services.openssh.settings.PermitRootLogin = "yes";
networking.firewall.allowedTCPPorts = [ 80 ];
system.stateVersion = "25.05";
}