diff options
Diffstat (limited to 'hosts')
-rw-r--r-- | hosts/vidhar/default.nix | 2 | ||||
-rw-r--r-- | hosts/vidhar/network/dhcp/default.nix | 106 |
2 files changed, 85 insertions, 23 deletions
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; | |||
387 | algorithm = "zstd"; | 387 | algorithm = "zstd"; |
388 | }; | 388 | }; |
389 | 389 | ||
390 | environment.systemPackages = with pkgs; [iotop vmtouch]; | 390 | environment.systemPackages = with pkgs; [iotop vmtouch inetutils]; |
391 | 391 | ||
392 | systemd.sysusers.enable = false; | 392 | systemd.sysusers.enable = false; |
393 | system.stateVersion = "21.05"; | 393 | 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 @@ | |||
2 | 2 | ||
3 | with lib; | 3 | with lib; |
4 | 4 | ||
5 | { | 5 | let |
6 | nfsrootBaseUrl = "http://nfsroot.vidhar.yggdrasil"; | ||
7 | in { | ||
6 | config = { | 8 | config = { |
7 | services.kea = { | 9 | services.kea = { |
8 | dhcp4 = { | 10 | dhcp4 = { |
@@ -26,13 +28,13 @@ with lib; | |||
26 | { name = "eostre-ipxe"; | 28 | { name = "eostre-ipxe"; |
27 | test = "hexstring(pkt4.mac, ':') == '00:d8:61:79:c5:40' and option[77].hex == 'iPXE'"; | 29 | test = "hexstring(pkt4.mac, ':') == '00:d8:61:79:c5:40' and option[77].hex == 'iPXE'"; |
28 | next-server = "10.141.0.1"; | 30 | next-server = "10.141.0.1"; |
29 | boot-file-name = "http://nfsroot.vidhar.yggdrasil/eostre/netboot.ipxe"; | 31 | boot-file-name = "${nfsrootBaseUrl}/eostre.menu.ipxe"; |
30 | only-if-required = true; | 32 | only-if-required = true; |
31 | } | 33 | } |
32 | { name = "ipxe"; | 34 | { name = "ipxe"; |
33 | test = "option[77].hex == 'iPXE'"; | 35 | test = "option[77].hex == 'iPXE'"; |
34 | next-server = "10.141.0.1"; | 36 | next-server = "10.141.0.1"; |
35 | boot-file-name = "http://nfsroot.vidhar.yggdrasil/installer-x86_64-linux/netboot.ipxe"; | 37 | boot-file-name = "${nfsrootBaseUrl}/installer-x86_64-linux.menu.ipxe"; |
36 | only-if-required = true; | 38 | only-if-required = true; |
37 | } | 39 | } |
38 | { name = "uefi-64"; | 40 | { name = "uefi-64"; |
@@ -252,31 +254,63 @@ with lib; | |||
252 | name = "nfsroot.vidhar.yggdrasil"; | 254 | name = "nfsroot.vidhar.yggdrasil"; |
253 | paths = | 255 | paths = |
254 | (map (system: | 256 | (map (system: |
255 | let | 257 | pkgs.symlinkJoin { |
256 | installerBuild = (flake.nixosConfigurations.${"installer-${system}-nfsroot"}.extendModules { | 258 | name = "installer-${system}"; |
257 | modules = [ | 259 | paths = [ |
258 | ({ ... }: { | 260 | (let |
259 | config.nfsroot.storeDevice = "10.141.0.1:nix-store"; | 261 | installerBuild = (flake.nixosConfigurations.${"installer-${system}-nfsroot"}.extendModules { |
260 | config.nfsroot.registrationUrl = "http://nfsroot.vidhar.yggdrasil/installer-${system}/registration"; | 262 | modules = [ |
261 | }) | 263 | ({ ... }: { |
262 | ]; | 264 | config.nfsroot.storeDevice = "10.141.0.1:nix-store"; |
263 | }).config.system.build; | 265 | config.nfsroot.registrationUrl = "${nfsrootBaseUrl}/installer-${system}/registration"; |
264 | in builtins.toPath (pkgs.runCommandLocal "install-${system}" {} '' | 266 | }) |
265 | mkdir -p $out/installer-${system} | 267 | ]; |
266 | install -m 0444 -t $out/installer-${system} \ | 268 | }).config.system.build; |
267 | ${installerBuild.initialRamdisk}/initrd \ | 269 | in builtins.toPath (pkgs.runCommandLocal "install-${system}" {} '' |
268 | ${installerBuild.kernel}/bzImage \ | 270 | mkdir -p $out/installer-${system} |
269 | ${installerBuild.netbootIpxeScript}/netboot.ipxe \ | 271 | install -m 0444 -t $out/installer-${system} \ |
270 | ${pkgs.closureInfo { rootPaths = installerBuild.storeContents; }}/registration | 272 | ${installerBuild.initialRamdisk}/initrd \ |
271 | '') | 273 | ${installerBuild.kernel}/bzImage \ |
272 | ) ["x86_64-linux"] | 274 | ${installerBuild.netbootIpxeScript}/netboot.ipxe \ |
275 | ${pkgs.closureInfo { rootPaths = installerBuild.storeContents; }}/registration | ||
276 | '')) | ||
277 | (pkgs.writeTextFile { | ||
278 | name = "installer-${system}.menu.ipxe"; | ||
279 | destination = "/installer-${system}.menu.ipxe"; | ||
280 | text = '' | ||
281 | :start | ||
282 | menu iPXE boot menu for installer-${system} | ||
283 | item installer Boot installer-${system} | ||
284 | item netboot netboot.xyz | ||
285 | item shell iPXE shell | ||
286 | choose --timeout 0 --default installer selected || goto shell | ||
287 | goto ''${selected} | ||
288 | |||
289 | :shell | ||
290 | shell | ||
291 | goto start | ||
292 | |||
293 | :installer | ||
294 | chain ${nfsrootBaseUrl}/installer-${system}/netboot.ipxe | ||
295 | goto start | ||
296 | |||
297 | :netboot | ||
298 | chain --autofree ${nfsrootBaseUrl}/netboot.xyz.efi | ||
299 | goto start | ||
300 | ''; | ||
301 | }) | ||
302 | ]; | ||
303 | }) ["x86_64-linux"] | ||
273 | ) ++ [ | 304 | ) ++ [ |
305 | (pkgs.linkFarm "netbootxyz-efi" [ | ||
306 | { name = "netboot.xyz.efi"; path = pkgs.netbootxyz-efi; } | ||
307 | ]) | ||
274 | (let | 308 | (let |
275 | eostreBuild = (flake.nixosConfigurations.eostre.extendModules { | 309 | eostreBuild = (flake.nixosConfigurations.eostre.extendModules { |
276 | modules = [ | 310 | modules = [ |
277 | ({ ... }: { | 311 | ({ ... }: { |
278 | config.nfsroot.storeDevice = "10.141.0.1:nix-store"; | 312 | config.nfsroot.storeDevice = "10.141.0.1:nix-store"; |
279 | config.nfsroot.registrationUrl = "http://nfsroot.vidhar.yggdrasil/eostre/registration"; | 313 | config.nfsroot.registrationUrl = "${nfsrootBaseUrl}/eostre/registration"; |
280 | }) | 314 | }) |
281 | ]; | 315 | ]; |
282 | }).config.system.build; | 316 | }).config.system.build; |
@@ -288,6 +322,34 @@ with lib; | |||
288 | ${eostreBuild.netbootIpxeScript}/netboot.ipxe \ | 322 | ${eostreBuild.netbootIpxeScript}/netboot.ipxe \ |
289 | ${pkgs.closureInfo { rootPaths = eostreBuild.storeContents; }}/registration | 323 | ${pkgs.closureInfo { rootPaths = eostreBuild.storeContents; }}/registration |
290 | '')) | 324 | '')) |
325 | (pkgs.writeTextFile { | ||
326 | name = "eostre.menu.ipxe"; | ||
327 | destination = "/eostre.menu.ipxe"; | ||
328 | text = '' | ||
329 | set menu-timeout 5000 | ||
330 | |||
331 | :start | ||
332 | menu iPXE boot menu for eostre | ||
333 | item eostre Boot eostre | ||
334 | item netboot netboot.xyz | ||
335 | item shell iPXE shell | ||
336 | choose --timeout ''${menu-timeout} --default eostre selected || goto shell | ||
337 | goto ''${selected} | ||
338 | |||
339 | :shell | ||
340 | shell | ||
341 | set menu-timeout 0 | ||
342 | goto start | ||
343 | |||
344 | :eostre | ||
345 | chain ${nfsrootBaseUrl}/eostre/netboot.ipxe | ||
346 | goto start | ||
347 | |||
348 | :netboot | ||
349 | chain --autofree ${nfsrootBaseUrl}/netboot.xyz.efi | ||
350 | goto start | ||
351 | ''; | ||
352 | }) | ||
291 | ]; | 353 | ]; |
292 | }; | 354 | }; |
293 | }; | 355 | }; |