From 6062f5eb44018f3756707e0001aee7dedc727d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Tue, 27 Jan 2026 12:06:02 +0000 Subject: [PATCH] ipxe --- hosts/mtworx/configuration.nix | 38 ++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/hosts/mtworx/configuration.nix b/hosts/mtworx/configuration.nix index 1615358..b96822f 100644 --- a/hosts/mtworx/configuration.nix +++ b/hosts/mtworx/configuration.nix @@ -6,8 +6,42 @@ }: let nvme = "/dev/disk/by-id/nvme-Samsung_SSD_990_PRO_2TB_S7DNNU0Y624491Y"; + + # iPXE boot menu script + ipxeMenu = pkgs.writeText "boot.ipxe" '' + #!ipxe + + :menu + menu PXE Boot Menu + item mrescue Boot mrescue (Rescue System) + item netbootxyz Boot netboot.xyz + item shell iPXE Shell + choose --default mrescue --timeout 10000 selected || goto menu + goto ''${selected} + + :mrescue + kernel tftp://10.14.143.1/mrescue/bzImage + initrd tftp://10.14.143.1/mrescue/initrd + boot + + :netbootxyz + chain tftp://10.14.143.1/netboot.xyz.efi + + :shell + shell + ''; + + # Custom iPXE with embedded menu + customIpxe = pkgs.ipxe.override { + embedScript = ipxeMenu; + }; + + # TFTP root directory with all boot files tftp-root = pkgs.runCommand "tftp-root" { } '' - mkdir -p $out + mkdir -p $out/mrescue + cp ${customIpxe}/ipxe.efi $out/boot.efi + cp ${pkgs.mrescue}/bzImage $out/mrescue/bzImage + cp ${pkgs.mrescue}/initrd $out/mrescue/initrd cp ${pkgs.netbootxyz-efi} $out/netboot.xyz.efi ''; in @@ -192,7 +226,7 @@ in dhcp-option = "66,\"0.0.0.0\""; enable-tftp = true; tftp-root = "${tftp-root}"; - dhcp-boot = "netboot.xyz.efi"; + dhcp-boot = "boot.efi"; }; }; };