From 7cccea3075c1e9109ac8eb2b9fad7dace337203d Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 29 Apr 2025 13:00:19 +0200 Subject: ... --- hosts/vidhar/network/dhcp/default.nix | 36 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'hosts/vidhar/network/dhcp') diff --git a/hosts/vidhar/network/dhcp/default.nix b/hosts/vidhar/network/dhcp/default.nix index 464fc5fe..5c910712 100644 --- a/hosts/vidhar/network/dhcp/default.nix +++ b/hosts/vidhar/network/dhcp/default.nix @@ -4,9 +4,11 @@ with lib; let nfsrootBaseUrl = "http://nfsroot.vidhar.yggdrasil"; + tftpIp = "10.141.0.1"; ipxe = pkgs.ipxe.override { additionalTargets = { - "bin-i386-efi/ipxe.efi" = "i386-ipxe.efi"; + "bin-i386-efi/snponly.efi" = "i386-snponly.efi"; + "bin-x86_64-efi/snponly.efi" = "snponly.efi"; }; additionalOptions = [ "NSLOOKUP_CMD" @@ -48,13 +50,13 @@ in { client-classes = [ { 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"; + next-server = tftpIp; boot-file-name = "${nfsrootBaseUrl}/eostre.menu.ipxe"; only-if-required = true; } { name = "ipxe-yggdrasil"; test = "option[77].hex == 'iPXE-yggdrasil'"; - next-server = "10.141.0.1"; + next-server = tftpIp; boot-file-name = "${nfsrootBaseUrl}/installer-x86_64-linux.menu.ipxe"; only-if-required = true; } @@ -64,18 +66,18 @@ in { option-data = [ { name = "vendor-class-identifier"; data = "HTTPClient"; } ]; - boot-file-name = "${nfsrootBaseUrl}/ipxe.efi"; + boot-file-name = "${nfsrootBaseUrl}/snponly.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"; + boot-file-name = "${nfsrootBaseUrl}/snponly.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"; + boot-file-name = "${nfsrootBaseUrl}/i386-snponly.efi"; only-if-required = true; } { name = "ipxe-legacy"; @@ -87,23 +89,23 @@ in { { 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'"; option-data = [ - { name = "tftp-server-name"; data = "10.141.0.1"; } + { name = "tftp-server-name"; data = tftpIp; } ]; - boot-file-name = "ipxe.efi"; + boot-file-name = "snponly.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'"; option-data = [ - { name = "tftp-server-name"; data = "10.141.0.1"; } + { name = "tftp-server-name"; data = tftpIp; } ]; - boot-file-name = "i386-ipxe.efi"; + boot-file-name = "i386-snponly.efi"; only-if-required = true; } { name = "legacy"; test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'"; option-data = [ - { name = "tftp-server-name"; data = "10.141.0.1"; } + { name = "tftp-server-name"; data = tftpIp; } ]; boot-file-name = "undionly.kpxe"; only-if-required = true; @@ -308,7 +310,7 @@ in { installerBuild = (flake.nixosConfigurations.${"installer-${system}-nfsroot"}.extendModules { modules = [ ({ ... }: { - config.nfsroot.storeDevice = "10.141.0.1:nix-store"; + config.nfsroot.storeDevice = "${tftpIp}:nix-store"; config.nfsroot.registrationUrl = "${nfsrootBaseUrl}/installer-${system}/registration"; }) ]; @@ -359,8 +361,8 @@ in { (pkgs.runCommandLocal "utils" {} '' mkdir $out install -m 0444 -t $out \ - ${ipxe}/ipxe.efi ${ipxe}/i386-ipxe.efi ${ipxe}/undionly.kpxe \ - ${pkgs.memtest86plus}/memtest.efi ${pkgs.memtest86plus}/memtest.bin + ${ipxe}/{snponly.efi,i386-snponly.efi,undionly.kpxe} \ + ${pkgs.memtest86plus}/{memtest.efi,memtest.bin} install -m 0444 ${sources.netbootxyz-efi.src} $out/netboot.xyz.efi install -m 0444 ${sources.netbootxyz-lkrn.src} $out/netboot.xyz.lkrn '') @@ -368,7 +370,7 @@ in { eostreBuild = (flake.nixosConfigurations.eostre.extendModules { modules = [ ({ ... }: { - config.nfsroot.storeDevice = "10.141.0.1:nix-store"; + config.nfsroot.storeDevice = "${tftpIp}:nix-store"; config.nfsroot.registrationUrl = "${nfsrootBaseUrl}/eostre/registration"; }) ]; @@ -430,9 +432,9 @@ in { tftpRoot = pkgs.runCommandLocal "netboot" {} '' mkdir -p $out install -m 0444 -t $out \ - ${ipxe}/ipxe.efi ${ipxe}/i386-ipxe.efi ${ipxe}/undionly.kpxe + ${ipxe}/snponly.efi ${ipxe}/i386-snponly.efi ${ipxe}/undionly.kpxe ''; - in "${pkgs.atftp}/sbin/atftpd --daemon --no-fork --bind-address=10.141.0.1 ${tftpRoot}"; + in "${pkgs.atftp}/sbin/atftpd --daemon --no-fork --bind-address=${tftpIp} ${tftpRoot}"; }; }; } -- cgit v1.2.3