From c76e92e540522b9fe24254463c25b8d67eebfd84 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 29 Apr 2025 11:47:34 +0200 Subject: ... --- _sources/generated.json | 30 ++++++++++ _sources/generated.nix | 16 +++++ hosts/vidhar/network/dhcp/default.nix | 110 ++++++++++++++++++++++++---------- nvfetcher.toml | 8 +++ 4 files changed, 134 insertions(+), 30 deletions(-) diff --git a/_sources/generated.json b/_sources/generated.json index d86f7005..b3604420 100644 --- a/_sources/generated.json +++ b/_sources/generated.json @@ -261,6 +261,36 @@ }, "version": "1f8c31457459ffc28cd1c3f3c2235a53efad7148" }, + "netbootxyz-efi": { + "cargoLocks": null, + "date": null, + "extract": null, + "name": "netbootxyz-efi", + "passthru": null, + "pinned": false, + "src": { + "name": null, + "sha256": "sha256-D0UnGL0H+zua5fJAoBbfEyU4ZdjQXf6LeQ+475oVKow=", + "type": "url", + "url": "https://github.com/netbootxyz/netboot.xyz/releases/download/2.0.86/netboot.xyz.efi" + }, + "version": "2.0.86" + }, + "netbootxyz-lkrn": { + "cargoLocks": null, + "date": null, + "extract": null, + "name": "netbootxyz-lkrn", + "passthru": null, + "pinned": false, + "src": { + "name": null, + "sha256": "sha256-zUuvv/MCXhgqBCa4dl4+bWtS+Z1PCDRUX0pGLonaWpY=", + "type": "url", + "url": "https://github.com/netbootxyz/netboot.xyz/releases/download/2.0.86/netboot.xyz.lkrn" + }, + "version": "2.0.86" + }, "postfix-mta-sts-resolver": { "cargoLocks": null, "date": null, diff --git a/_sources/generated.nix b/_sources/generated.nix index a7ebef8a..c3b65800 100644 --- a/_sources/generated.nix +++ b/_sources/generated.nix @@ -162,6 +162,22 @@ }; date = "2020-02-10"; }; + netbootxyz-efi = { + pname = "netbootxyz-efi"; + version = "2.0.86"; + src = fetchurl { + url = "https://github.com/netbootxyz/netboot.xyz/releases/download/2.0.86/netboot.xyz.efi"; + sha256 = "sha256-D0UnGL0H+zua5fJAoBbfEyU4ZdjQXf6LeQ+475oVKow="; + }; + }; + netbootxyz-lkrn = { + pname = "netbootxyz-lkrn"; + version = "2.0.86"; + src = fetchurl { + url = "https://github.com/netbootxyz/netboot.xyz/releases/download/2.0.86/netboot.xyz.lkrn"; + sha256 = "sha256-zUuvv/MCXhgqBCa4dl4+bWtS+Z1PCDRUX0pGLonaWpY="; + }; + }; postfix-mta-sts-resolver = { pname = "postfix-mta-sts-resolver"; version = "1.5.0"; diff --git a/hosts/vidhar/network/dhcp/default.nix b/hosts/vidhar/network/dhcp/default.nix index 38dd9ae8..bd13b972 100644 --- a/hosts/vidhar/network/dhcp/default.nix +++ b/hosts/vidhar/network/dhcp/default.nix @@ -1,9 +1,27 @@ -{ flake, config, pkgs, lib, ... }: +{ flake, config, pkgs, lib, sources, ... }: with lib; let nfsrootBaseUrl = "http://nfsroot.vidhar.yggdrasil"; + ipxe = pkgs.ipxe.override { + additionalTargets = { + "bin-i386-efi/ipxe.efi" = "i386-ipxe.efi"; + }; + additionalOptions = [ + "NSLOOKUP_CMD" + "PING_CMD" + "CONSOLE_CMD" + ]; + embedScript = pkgs.writeText "yggdrasil.ipxe" '' + #!ipxe + + set user-class iPXE-yggdrasil + + dhcp + autoboot + ''; + }; in { config = { services.kea = { @@ -25,41 +43,67 @@ in { }; client-classes = [ - { name = "eostre-ipxe"; - test = "hexstring(pkt4.mac, ':') == '00:d8:61:79:c5:40' and option[77].hex == 'iPXE'"; + { name = "ipxe-eostre"; + test = "hexstring(pkt4.mac, ':') == '00:d8:61:79:c5:40' and option[77].hex == 'iPXE-yggdrasil'"; next-server = "10.141.0.1"; boot-file-name = "${nfsrootBaseUrl}/eostre.menu.ipxe"; only-if-required = true; } - { name = "ipxe"; - test = "option[77].hex == 'iPXE'"; + { name = "ipxe-yggdrasil"; + test = "option[77].hex == 'iPXE-yggdrasil'"; next-server = "10.141.0.1"; boot-file-name = "${nfsrootBaseUrl}/installer-x86_64-linux.menu.ipxe"; only-if-required = true; } + + { name = "uefi-http"; + test = "option[client-system].hex == 0x0010"; + option-data = [ + { name = "vendor-class-identifier"; data = "HTTPClient"; } + ]; + boot-file-name = "${nfsrootBaseUrl}/ipxe.efi"; + only-if-required = true; + } + + { name = "ipxe-uefi-64"; + test = "option[77].hex == 'iPXE' and (substring(option[60].hex,0,20) == 'PXEClient:Arch:00007' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00008' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00009')"; + boot-file-name = "${nfsrootBaseUrl}/ipxe.efi"; + only-if-required = true; + } + { name = "ipxe-uefi-32"; + test = "option[77].hex == 'iPXE' and (substring(option[60].hex,0,20) == 'PXEClient:Arch:00002' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00006')"; + boot-file-name = "${nfsrootBaseUrl}/i386-ipxe.efi"; + only-if-required = true; + } + { name = "ipxe-legacy"; + test = "option[77].hex == 'iPXE' and substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'"; + boot-file-name = "${nfsrootBaseUrl}/undionly.kpxe"; + only-if-required = true; + } + { name = "uefi-64"; test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00007' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00008' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00009'"; - only-if-required = true; option-data = [ { name = "tftp-server-name"; data = "10.141.0.1"; } ]; boot-file-name = "ipxe.efi"; + only-if-required = true; } { name = "uefi-32"; test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00002' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00006'"; - only-if-required = true; option-data = [ { name = "tftp-server-name"; data = "10.141.0.1"; } ]; boot-file-name = "i386-ipxe.efi"; + only-if-required = true; } { name = "legacy"; test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'"; - only-if-required = true; option-data = [ { name = "tftp-server-name"; data = "10.141.0.1"; } ]; boot-file-name = "undionly.kpxe"; + only-if-required = true; } ]; @@ -278,9 +322,15 @@ in { name = "installer-${system}.menu.ipxe"; destination = "/installer-${system}.menu.ipxe"; text = '' + #!ipxe + + cpair --background 9 1 + cpair --background 9 3 + cpair --background 9 6 + :start menu iPXE boot menu for installer-${system} - item installer Boot installer-${system} + item installer installer-${system} item memtest memtest86plus item netboot netboot.xyz item shell iPXE shell @@ -292,27 +342,28 @@ in { goto start :installer - chain ${nfsrootBaseUrl}/installer-${system}/netboot.ipxe + chain installer-${system}/netboot.ipxe goto start :netboot - chain --autofree ${nfsrootBaseUrl}/netboot.xyz.efi + iseq ''${platform} efi && chain --autofree netboot.xyz.efi || chain --autofree netboot.xyz.lkrn goto start :memtest - chain --autofree ${nfsrootBaseUrl}/memtest.efi + iseq ''${platform} efi && chain --autofree memtest.efi || chain --autofree memtest.bin goto start ''; }) ]; }) ["x86_64-linux"] ) ++ [ - (pkgs.linkFarm "netbootxyz-efi" [ - { name = "netboot.xyz.efi"; path = pkgs.netbootxyz-efi; } - ]) - (pkgs.runCommandLocal "memtest" {} '' + (pkgs.runCommandLocal "utils" {} '' mkdir $out - install -t $out ${pkgs.memtest86plus}/memtest.efi + install -m 0444 -t $out \ + ${ipxe}/ipxe.efi ${ipxe}/i386-ipxe.efi ${ipxe}/undionly.kpxe \ + ${pkgs.memtest86plus}/memtest.efi ${pkgs.memtest86plus}/memtest.bin + install -m 0444 ${sources.netbootxyz-efi.src} $out/netboot.xyz.efi + install -m 0444 ${sources.netbootxyz-lkrn.src} $out/netboot.xyz.lkrn '') (let eostreBuild = (flake.nixosConfigurations.eostre.extendModules { @@ -335,32 +386,39 @@ in { name = "eostre.menu.ipxe"; destination = "/eostre.menu.ipxe"; text = '' + #!ipxe + + cpair --background 9 1 + cpair --background 9 3 + cpair --background 9 6 + set menu-timeout 5000 :start menu iPXE boot menu for eostre - item eostre Boot eostre + item eostre eostre item memtest memtest86plus item netboot netboot.xyz item shell iPXE shell choose --timeout ''${menu-timeout} --default eostre selected || goto shell + set menu-timeout 0 goto ''${selected} :shell - shell set menu-timeout 0 + shell goto start :eostre - chain ${nfsrootBaseUrl}/eostre/netboot.ipxe + chain eostre/netboot.ipxe goto start :netboot - chain --autofree ${nfsrootBaseUrl}/netboot.xyz.efi + iseq ''${platform} efi && chain --autofree netboot.xyz.efi || chain --autofree netboot.xyz.lkrn goto start :memtest - chain --autofree ${nfsrootBaseUrl}/memtest.efi + iseq ''${platform} efi && chain --autofree memtest.efi || chain --autofree memtest.bin goto start ''; }) @@ -374,14 +432,6 @@ in { after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; serviceConfig.ExecStart = let - ipxe = pkgs.ipxe.override { - additionalTargets = { - "bin-i386-efi/ipxe.efi" = "i386-ipxe.efi"; - }; - additionalOptions = [ - "NSLOOKUP_CMD" - ]; - }; tftpRoot = pkgs.runCommandLocal "netboot" {} '' mkdir -p $out install -m 0444 -t $out \ diff --git a/nvfetcher.toml b/nvfetcher.toml index ecaebba0..72c0d99d 100644 --- a/nvfetcher.toml +++ b/nvfetcher.toml @@ -115,3 +115,11 @@ fetch.git = "https://github.com/emersion/mako" [swayosd] src.git = "https://github.com/ErikReider/SwayOSD" fetch.git = "https://github.com/ErikReider/SwayOSD" + +[netbootxyz-efi] +src.github = "netbootxyz/netboot.xyz" +fetch.url = "https://github.com/netbootxyz/netboot.xyz/releases/download/$ver/netboot.xyz.efi" + +[netbootxyz-lkrn] +src.github = "netbootxyz/netboot.xyz" +fetch.url = "https://github.com/netbootxyz/netboot.xyz/releases/download/$ver/netboot.xyz.lkrn" -- cgit v1.2.3