From 6529a9248fae3e627ef85d2eaa29c68abc771efb Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 29 Apr 2025 09:49:35 +0200 Subject: ... --- hosts/vidhar/default.nix | 2 +- hosts/vidhar/network/dhcp/default.nix | 106 +++++++++++++++++++++++++++------- 2 files changed, 85 insertions(+), 23 deletions(-) (limited to 'hosts') diff --git a/hosts/vidhar/default.nix b/hosts/vidhar/default.nix index 90ab40dd..1af9c5e0 100644 --- a/hosts/vidhar/default.nix +++ b/hosts/vidhar/default.nix @@ -387,7 +387,7 @@ with lib; algorithm = "zstd"; }; - environment.systemPackages = with pkgs; [iotop vmtouch]; + environment.systemPackages = with pkgs; [iotop vmtouch inetutils]; systemd.sysusers.enable = false; system.stateVersion = "21.05"; diff --git a/hosts/vidhar/network/dhcp/default.nix b/hosts/vidhar/network/dhcp/default.nix index 07a83351..4151111d 100644 --- a/hosts/vidhar/network/dhcp/default.nix +++ b/hosts/vidhar/network/dhcp/default.nix @@ -2,7 +2,9 @@ with lib; -{ +let + nfsrootBaseUrl = "http://nfsroot.vidhar.yggdrasil"; +in { config = { services.kea = { dhcp4 = { @@ -26,13 +28,13 @@ with lib; { name = "eostre-ipxe"; test = "hexstring(pkt4.mac, ':') == '00:d8:61:79:c5:40' and option[77].hex == 'iPXE'"; next-server = "10.141.0.1"; - boot-file-name = "http://nfsroot.vidhar.yggdrasil/eostre/netboot.ipxe"; + boot-file-name = "${nfsrootBaseUrl}/eostre.menu.ipxe"; only-if-required = true; } { name = "ipxe"; test = "option[77].hex == 'iPXE'"; next-server = "10.141.0.1"; - boot-file-name = "http://nfsroot.vidhar.yggdrasil/installer-x86_64-linux/netboot.ipxe"; + boot-file-name = "${nfsrootBaseUrl}/installer-x86_64-linux.menu.ipxe"; only-if-required = true; } { name = "uefi-64"; @@ -252,31 +254,63 @@ with lib; name = "nfsroot.vidhar.yggdrasil"; paths = (map (system: - let - installerBuild = (flake.nixosConfigurations.${"installer-${system}-nfsroot"}.extendModules { - modules = [ - ({ ... }: { - config.nfsroot.storeDevice = "10.141.0.1:nix-store"; - config.nfsroot.registrationUrl = "http://nfsroot.vidhar.yggdrasil/installer-${system}/registration"; - }) - ]; - }).config.system.build; - in builtins.toPath (pkgs.runCommandLocal "install-${system}" {} '' - mkdir -p $out/installer-${system} - install -m 0444 -t $out/installer-${system} \ - ${installerBuild.initialRamdisk}/initrd \ - ${installerBuild.kernel}/bzImage \ - ${installerBuild.netbootIpxeScript}/netboot.ipxe \ - ${pkgs.closureInfo { rootPaths = installerBuild.storeContents; }}/registration - '') - ) ["x86_64-linux"] + pkgs.symlinkJoin { + name = "installer-${system}"; + paths = [ + (let + installerBuild = (flake.nixosConfigurations.${"installer-${system}-nfsroot"}.extendModules { + modules = [ + ({ ... }: { + config.nfsroot.storeDevice = "10.141.0.1:nix-store"; + config.nfsroot.registrationUrl = "${nfsrootBaseUrl}/installer-${system}/registration"; + }) + ]; + }).config.system.build; + in builtins.toPath (pkgs.runCommandLocal "install-${system}" {} '' + mkdir -p $out/installer-${system} + install -m 0444 -t $out/installer-${system} \ + ${installerBuild.initialRamdisk}/initrd \ + ${installerBuild.kernel}/bzImage \ + ${installerBuild.netbootIpxeScript}/netboot.ipxe \ + ${pkgs.closureInfo { rootPaths = installerBuild.storeContents; }}/registration + '')) + (pkgs.writeTextFile { + name = "installer-${system}.menu.ipxe"; + destination = "/installer-${system}.menu.ipxe"; + text = '' + :start + menu iPXE boot menu for installer-${system} + item installer Boot installer-${system} + item netboot netboot.xyz + item shell iPXE shell + choose --timeout 0 --default installer selected || goto shell + goto ''${selected} + + :shell + shell + goto start + + :installer + chain ${nfsrootBaseUrl}/installer-${system}/netboot.ipxe + goto start + + :netboot + chain --autofree ${nfsrootBaseUrl}/netboot.xyz.efi + goto start + ''; + }) + ]; + }) ["x86_64-linux"] ) ++ [ + (pkgs.linkFarm "netbootxyz-efi" [ + { name = "netboot.xyz.efi"; path = pkgs.netbootxyz-efi; } + ]) (let eostreBuild = (flake.nixosConfigurations.eostre.extendModules { modules = [ ({ ... }: { config.nfsroot.storeDevice = "10.141.0.1:nix-store"; - config.nfsroot.registrationUrl = "http://nfsroot.vidhar.yggdrasil/eostre/registration"; + config.nfsroot.registrationUrl = "${nfsrootBaseUrl}/eostre/registration"; }) ]; }).config.system.build; @@ -288,6 +322,34 @@ with lib; ${eostreBuild.netbootIpxeScript}/netboot.ipxe \ ${pkgs.closureInfo { rootPaths = eostreBuild.storeContents; }}/registration '')) + (pkgs.writeTextFile { + name = "eostre.menu.ipxe"; + destination = "/eostre.menu.ipxe"; + text = '' + set menu-timeout 5000 + + :start + menu iPXE boot menu for eostre + item eostre Boot eostre + item netboot netboot.xyz + item shell iPXE shell + choose --timeout ''${menu-timeout} --default eostre selected || goto shell + goto ''${selected} + + :shell + shell + set menu-timeout 0 + goto start + + :eostre + chain ${nfsrootBaseUrl}/eostre/netboot.ipxe + goto start + + :netboot + chain --autofree ${nfsrootBaseUrl}/netboot.xyz.efi + goto start + ''; + }) ]; }; }; -- cgit v1.2.3