diff options
-rw-r--r-- | hosts/vidhar/network/dhcp/default.nix | 36 |
1 files changed, 19 insertions, 17 deletions
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; | |||
4 | 4 | ||
5 | let | 5 | let |
6 | nfsrootBaseUrl = "http://nfsroot.vidhar.yggdrasil"; | 6 | nfsrootBaseUrl = "http://nfsroot.vidhar.yggdrasil"; |
7 | tftpIp = "10.141.0.1"; | ||
7 | ipxe = pkgs.ipxe.override { | 8 | ipxe = pkgs.ipxe.override { |
8 | additionalTargets = { | 9 | additionalTargets = { |
9 | "bin-i386-efi/ipxe.efi" = "i386-ipxe.efi"; | 10 | "bin-i386-efi/snponly.efi" = "i386-snponly.efi"; |
11 | "bin-x86_64-efi/snponly.efi" = "snponly.efi"; | ||
10 | }; | 12 | }; |
11 | additionalOptions = [ | 13 | additionalOptions = [ |
12 | "NSLOOKUP_CMD" | 14 | "NSLOOKUP_CMD" |
@@ -48,13 +50,13 @@ in { | |||
48 | client-classes = [ | 50 | client-classes = [ |
49 | { name = "ipxe-eostre"; | 51 | { name = "ipxe-eostre"; |
50 | test = "hexstring(pkt4.mac, ':') == '00:d8:61:79:c5:40' and option[77].hex == 'iPXE-yggdrasil'"; | 52 | test = "hexstring(pkt4.mac, ':') == '00:d8:61:79:c5:40' and option[77].hex == 'iPXE-yggdrasil'"; |
51 | next-server = "10.141.0.1"; | 53 | next-server = tftpIp; |
52 | boot-file-name = "${nfsrootBaseUrl}/eostre.menu.ipxe"; | 54 | boot-file-name = "${nfsrootBaseUrl}/eostre.menu.ipxe"; |
53 | only-if-required = true; | 55 | only-if-required = true; |
54 | } | 56 | } |
55 | { name = "ipxe-yggdrasil"; | 57 | { name = "ipxe-yggdrasil"; |
56 | test = "option[77].hex == 'iPXE-yggdrasil'"; | 58 | test = "option[77].hex == 'iPXE-yggdrasil'"; |
57 | next-server = "10.141.0.1"; | 59 | next-server = tftpIp; |
58 | boot-file-name = "${nfsrootBaseUrl}/installer-x86_64-linux.menu.ipxe"; | 60 | boot-file-name = "${nfsrootBaseUrl}/installer-x86_64-linux.menu.ipxe"; |
59 | only-if-required = true; | 61 | only-if-required = true; |
60 | } | 62 | } |
@@ -64,18 +66,18 @@ in { | |||
64 | option-data = [ | 66 | option-data = [ |
65 | { name = "vendor-class-identifier"; data = "HTTPClient"; } | 67 | { name = "vendor-class-identifier"; data = "HTTPClient"; } |
66 | ]; | 68 | ]; |
67 | boot-file-name = "${nfsrootBaseUrl}/ipxe.efi"; | 69 | boot-file-name = "${nfsrootBaseUrl}/snponly.efi"; |
68 | only-if-required = true; | 70 | only-if-required = true; |
69 | } | 71 | } |
70 | 72 | ||
71 | { name = "ipxe-uefi-64"; | 73 | { name = "ipxe-uefi-64"; |
72 | 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')"; | 74 | 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')"; |
73 | boot-file-name = "${nfsrootBaseUrl}/ipxe.efi"; | 75 | boot-file-name = "${nfsrootBaseUrl}/snponly.efi"; |
74 | only-if-required = true; | 76 | only-if-required = true; |
75 | } | 77 | } |
76 | { name = "ipxe-uefi-32"; | 78 | { name = "ipxe-uefi-32"; |
77 | 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')"; | 79 | 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')"; |
78 | boot-file-name = "${nfsrootBaseUrl}/i386-ipxe.efi"; | 80 | boot-file-name = "${nfsrootBaseUrl}/i386-snponly.efi"; |
79 | only-if-required = true; | 81 | only-if-required = true; |
80 | } | 82 | } |
81 | { name = "ipxe-legacy"; | 83 | { name = "ipxe-legacy"; |
@@ -87,23 +89,23 @@ in { | |||
87 | { name = "uefi-64"; | 89 | { name = "uefi-64"; |
88 | 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'"; | 90 | 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'"; |
89 | option-data = [ | 91 | option-data = [ |
90 | { name = "tftp-server-name"; data = "10.141.0.1"; } | 92 | { name = "tftp-server-name"; data = tftpIp; } |
91 | ]; | 93 | ]; |
92 | boot-file-name = "ipxe.efi"; | 94 | boot-file-name = "snponly.efi"; |
93 | only-if-required = true; | 95 | only-if-required = true; |
94 | } | 96 | } |
95 | { name = "uefi-32"; | 97 | { name = "uefi-32"; |
96 | test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00002' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00006'"; | 98 | test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00002' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00006'"; |
97 | option-data = [ | 99 | option-data = [ |
98 | { name = "tftp-server-name"; data = "10.141.0.1"; } | 100 | { name = "tftp-server-name"; data = tftpIp; } |
99 | ]; | 101 | ]; |
100 | boot-file-name = "i386-ipxe.efi"; | 102 | boot-file-name = "i386-snponly.efi"; |
101 | only-if-required = true; | 103 | only-if-required = true; |
102 | } | 104 | } |
103 | { name = "legacy"; | 105 | { name = "legacy"; |
104 | test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'"; | 106 | test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'"; |
105 | option-data = [ | 107 | option-data = [ |
106 | { name = "tftp-server-name"; data = "10.141.0.1"; } | 108 | { name = "tftp-server-name"; data = tftpIp; } |
107 | ]; | 109 | ]; |
108 | boot-file-name = "undionly.kpxe"; | 110 | boot-file-name = "undionly.kpxe"; |
109 | only-if-required = true; | 111 | only-if-required = true; |
@@ -308,7 +310,7 @@ in { | |||
308 | installerBuild = (flake.nixosConfigurations.${"installer-${system}-nfsroot"}.extendModules { | 310 | installerBuild = (flake.nixosConfigurations.${"installer-${system}-nfsroot"}.extendModules { |
309 | modules = [ | 311 | modules = [ |
310 | ({ ... }: { | 312 | ({ ... }: { |
311 | config.nfsroot.storeDevice = "10.141.0.1:nix-store"; | 313 | config.nfsroot.storeDevice = "${tftpIp}:nix-store"; |
312 | config.nfsroot.registrationUrl = "${nfsrootBaseUrl}/installer-${system}/registration"; | 314 | config.nfsroot.registrationUrl = "${nfsrootBaseUrl}/installer-${system}/registration"; |
313 | }) | 315 | }) |
314 | ]; | 316 | ]; |
@@ -359,8 +361,8 @@ in { | |||
359 | (pkgs.runCommandLocal "utils" {} '' | 361 | (pkgs.runCommandLocal "utils" {} '' |
360 | mkdir $out | 362 | mkdir $out |
361 | install -m 0444 -t $out \ | 363 | install -m 0444 -t $out \ |
362 | ${ipxe}/ipxe.efi ${ipxe}/i386-ipxe.efi ${ipxe}/undionly.kpxe \ | 364 | ${ipxe}/{snponly.efi,i386-snponly.efi,undionly.kpxe} \ |
363 | ${pkgs.memtest86plus}/memtest.efi ${pkgs.memtest86plus}/memtest.bin | 365 | ${pkgs.memtest86plus}/{memtest.efi,memtest.bin} |
364 | install -m 0444 ${sources.netbootxyz-efi.src} $out/netboot.xyz.efi | 366 | install -m 0444 ${sources.netbootxyz-efi.src} $out/netboot.xyz.efi |
365 | install -m 0444 ${sources.netbootxyz-lkrn.src} $out/netboot.xyz.lkrn | 367 | install -m 0444 ${sources.netbootxyz-lkrn.src} $out/netboot.xyz.lkrn |
366 | '') | 368 | '') |
@@ -368,7 +370,7 @@ in { | |||
368 | eostreBuild = (flake.nixosConfigurations.eostre.extendModules { | 370 | eostreBuild = (flake.nixosConfigurations.eostre.extendModules { |
369 | modules = [ | 371 | modules = [ |
370 | ({ ... }: { | 372 | ({ ... }: { |
371 | config.nfsroot.storeDevice = "10.141.0.1:nix-store"; | 373 | config.nfsroot.storeDevice = "${tftpIp}:nix-store"; |
372 | config.nfsroot.registrationUrl = "${nfsrootBaseUrl}/eostre/registration"; | 374 | config.nfsroot.registrationUrl = "${nfsrootBaseUrl}/eostre/registration"; |
373 | }) | 375 | }) |
374 | ]; | 376 | ]; |
@@ -430,9 +432,9 @@ in { | |||
430 | tftpRoot = pkgs.runCommandLocal "netboot" {} '' | 432 | tftpRoot = pkgs.runCommandLocal "netboot" {} '' |
431 | mkdir -p $out | 433 | mkdir -p $out |
432 | install -m 0444 -t $out \ | 434 | install -m 0444 -t $out \ |
433 | ${ipxe}/ipxe.efi ${ipxe}/i386-ipxe.efi ${ipxe}/undionly.kpxe | 435 | ${ipxe}/snponly.efi ${ipxe}/i386-snponly.efi ${ipxe}/undionly.kpxe |
434 | ''; | 436 | ''; |
435 | in "${pkgs.atftp}/sbin/atftpd --daemon --no-fork --bind-address=10.141.0.1 ${tftpRoot}"; | 437 | in "${pkgs.atftp}/sbin/atftpd --daemon --no-fork --bind-address=${tftpIp} ${tftpRoot}"; |
436 | }; | 438 | }; |
437 | }; | 439 | }; |
438 | } | 440 | } |