summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2025-04-29 11:47:34 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2025-04-29 11:47:34 +0200
commitc76e92e540522b9fe24254463c25b8d67eebfd84 (patch)
tree6e5cdec4a481865c55ac2c11d1a2e25fcfe9f6b1
parent272a7f0aeca0fccf3cc935a3eed51d064720d864 (diff)
downloadnixos-c76e92e540522b9fe24254463c25b8d67eebfd84.tar
nixos-c76e92e540522b9fe24254463c25b8d67eebfd84.tar.gz
nixos-c76e92e540522b9fe24254463c25b8d67eebfd84.tar.bz2
nixos-c76e92e540522b9fe24254463c25b8d67eebfd84.tar.xz
nixos-c76e92e540522b9fe24254463c25b8d67eebfd84.zip
...
-rw-r--r--_sources/generated.json30
-rw-r--r--_sources/generated.nix16
-rw-r--r--hosts/vidhar/network/dhcp/default.nix110
-rw-r--r--nvfetcher.toml8
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 @@
261 }, 261 },
262 "version": "1f8c31457459ffc28cd1c3f3c2235a53efad7148" 262 "version": "1f8c31457459ffc28cd1c3f3c2235a53efad7148"
263 }, 263 },
264 "netbootxyz-efi": {
265 "cargoLocks": null,
266 "date": null,
267 "extract": null,
268 "name": "netbootxyz-efi",
269 "passthru": null,
270 "pinned": false,
271 "src": {
272 "name": null,
273 "sha256": "sha256-D0UnGL0H+zua5fJAoBbfEyU4ZdjQXf6LeQ+475oVKow=",
274 "type": "url",
275 "url": "https://github.com/netbootxyz/netboot.xyz/releases/download/2.0.86/netboot.xyz.efi"
276 },
277 "version": "2.0.86"
278 },
279 "netbootxyz-lkrn": {
280 "cargoLocks": null,
281 "date": null,
282 "extract": null,
283 "name": "netbootxyz-lkrn",
284 "passthru": null,
285 "pinned": false,
286 "src": {
287 "name": null,
288 "sha256": "sha256-zUuvv/MCXhgqBCa4dl4+bWtS+Z1PCDRUX0pGLonaWpY=",
289 "type": "url",
290 "url": "https://github.com/netbootxyz/netboot.xyz/releases/download/2.0.86/netboot.xyz.lkrn"
291 },
292 "version": "2.0.86"
293 },
264 "postfix-mta-sts-resolver": { 294 "postfix-mta-sts-resolver": {
265 "cargoLocks": null, 295 "cargoLocks": null,
266 "date": null, 296 "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 @@
162 }; 162 };
163 date = "2020-02-10"; 163 date = "2020-02-10";
164 }; 164 };
165 netbootxyz-efi = {
166 pname = "netbootxyz-efi";
167 version = "2.0.86";
168 src = fetchurl {
169 url = "https://github.com/netbootxyz/netboot.xyz/releases/download/2.0.86/netboot.xyz.efi";
170 sha256 = "sha256-D0UnGL0H+zua5fJAoBbfEyU4ZdjQXf6LeQ+475oVKow=";
171 };
172 };
173 netbootxyz-lkrn = {
174 pname = "netbootxyz-lkrn";
175 version = "2.0.86";
176 src = fetchurl {
177 url = "https://github.com/netbootxyz/netboot.xyz/releases/download/2.0.86/netboot.xyz.lkrn";
178 sha256 = "sha256-zUuvv/MCXhgqBCa4dl4+bWtS+Z1PCDRUX0pGLonaWpY=";
179 };
180 };
165 postfix-mta-sts-resolver = { 181 postfix-mta-sts-resolver = {
166 pname = "postfix-mta-sts-resolver"; 182 pname = "postfix-mta-sts-resolver";
167 version = "1.5.0"; 183 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 @@
1{ flake, config, pkgs, lib, ... }: 1{ flake, config, pkgs, lib, sources, ... }:
2 2
3with lib; 3with lib;
4 4
5let 5let
6 nfsrootBaseUrl = "http://nfsroot.vidhar.yggdrasil"; 6 nfsrootBaseUrl = "http://nfsroot.vidhar.yggdrasil";
7 ipxe = pkgs.ipxe.override {
8 additionalTargets = {
9 "bin-i386-efi/ipxe.efi" = "i386-ipxe.efi";
10 };
11 additionalOptions = [
12 "NSLOOKUP_CMD"
13 "PING_CMD"
14 "CONSOLE_CMD"
15 ];
16 embedScript = pkgs.writeText "yggdrasil.ipxe" ''
17 #!ipxe
18
19 set user-class iPXE-yggdrasil
20
21 dhcp
22 autoboot
23 '';
24 };
7in { 25in {
8 config = { 26 config = {
9 services.kea = { 27 services.kea = {
@@ -25,41 +43,67 @@ in {
25 }; 43 };
26 44
27 client-classes = [ 45 client-classes = [
28 { name = "eostre-ipxe"; 46 { name = "ipxe-eostre";
29 test = "hexstring(pkt4.mac, ':') == '00:d8:61:79:c5:40' and option[77].hex == 'iPXE'"; 47 test = "hexstring(pkt4.mac, ':') == '00:d8:61:79:c5:40' and option[77].hex == 'iPXE-yggdrasil'";
30 next-server = "10.141.0.1"; 48 next-server = "10.141.0.1";
31 boot-file-name = "${nfsrootBaseUrl}/eostre.menu.ipxe"; 49 boot-file-name = "${nfsrootBaseUrl}/eostre.menu.ipxe";
32 only-if-required = true; 50 only-if-required = true;
33 } 51 }
34 { name = "ipxe"; 52 { name = "ipxe-yggdrasil";
35 test = "option[77].hex == 'iPXE'"; 53 test = "option[77].hex == 'iPXE-yggdrasil'";
36 next-server = "10.141.0.1"; 54 next-server = "10.141.0.1";
37 boot-file-name = "${nfsrootBaseUrl}/installer-x86_64-linux.menu.ipxe"; 55 boot-file-name = "${nfsrootBaseUrl}/installer-x86_64-linux.menu.ipxe";
38 only-if-required = true; 56 only-if-required = true;
39 } 57 }
58
59 { name = "uefi-http";
60 test = "option[client-system].hex == 0x0010";
61 option-data = [
62 { name = "vendor-class-identifier"; data = "HTTPClient"; }
63 ];
64 boot-file-name = "${nfsrootBaseUrl}/ipxe.efi";
65 only-if-required = true;
66 }
67
68 { name = "ipxe-uefi-64";
69 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')";
70 boot-file-name = "${nfsrootBaseUrl}/ipxe.efi";
71 only-if-required = true;
72 }
73 { name = "ipxe-uefi-32";
74 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')";
75 boot-file-name = "${nfsrootBaseUrl}/i386-ipxe.efi";
76 only-if-required = true;
77 }
78 { name = "ipxe-legacy";
79 test = "option[77].hex == 'iPXE' and substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'";
80 boot-file-name = "${nfsrootBaseUrl}/undionly.kpxe";
81 only-if-required = true;
82 }
83
40 { name = "uefi-64"; 84 { name = "uefi-64";
41 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'"; 85 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'";
42 only-if-required = true;
43 option-data = [ 86 option-data = [
44 { name = "tftp-server-name"; data = "10.141.0.1"; } 87 { name = "tftp-server-name"; data = "10.141.0.1"; }
45 ]; 88 ];
46 boot-file-name = "ipxe.efi"; 89 boot-file-name = "ipxe.efi";
90 only-if-required = true;
47 } 91 }
48 { name = "uefi-32"; 92 { name = "uefi-32";
49 test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00002' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00006'"; 93 test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00002' or substring(option[60].hex,0,20) == 'PXEClient:Arch:00006'";
50 only-if-required = true;
51 option-data = [ 94 option-data = [
52 { name = "tftp-server-name"; data = "10.141.0.1"; } 95 { name = "tftp-server-name"; data = "10.141.0.1"; }
53 ]; 96 ];
54 boot-file-name = "i386-ipxe.efi"; 97 boot-file-name = "i386-ipxe.efi";
98 only-if-required = true;
55 } 99 }
56 { name = "legacy"; 100 { name = "legacy";
57 test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'"; 101 test = "substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'";
58 only-if-required = true;
59 option-data = [ 102 option-data = [
60 { name = "tftp-server-name"; data = "10.141.0.1"; } 103 { name = "tftp-server-name"; data = "10.141.0.1"; }
61 ]; 104 ];
62 boot-file-name = "undionly.kpxe"; 105 boot-file-name = "undionly.kpxe";
106 only-if-required = true;
63 } 107 }
64 ]; 108 ];
65 109
@@ -278,9 +322,15 @@ in {
278 name = "installer-${system}.menu.ipxe"; 322 name = "installer-${system}.menu.ipxe";
279 destination = "/installer-${system}.menu.ipxe"; 323 destination = "/installer-${system}.menu.ipxe";
280 text = '' 324 text = ''
325 #!ipxe
326
327 cpair --background 9 1
328 cpair --background 9 3
329 cpair --background 9 6
330
281 :start 331 :start
282 menu iPXE boot menu for installer-${system} 332 menu iPXE boot menu for installer-${system}
283 item installer Boot installer-${system} 333 item installer installer-${system}
284 item memtest memtest86plus 334 item memtest memtest86plus
285 item netboot netboot.xyz 335 item netboot netboot.xyz
286 item shell iPXE shell 336 item shell iPXE shell
@@ -292,27 +342,28 @@ in {
292 goto start 342 goto start
293 343
294 :installer 344 :installer
295 chain ${nfsrootBaseUrl}/installer-${system}/netboot.ipxe 345 chain installer-${system}/netboot.ipxe
296 goto start 346 goto start
297 347
298 :netboot 348 :netboot
299 chain --autofree ${nfsrootBaseUrl}/netboot.xyz.efi 349 iseq ''${platform} efi && chain --autofree netboot.xyz.efi || chain --autofree netboot.xyz.lkrn
300 goto start 350 goto start
301 351
302 :memtest 352 :memtest
303 chain --autofree ${nfsrootBaseUrl}/memtest.efi 353 iseq ''${platform} efi && chain --autofree memtest.efi || chain --autofree memtest.bin
304 goto start 354 goto start
305 ''; 355 '';
306 }) 356 })
307 ]; 357 ];
308 }) ["x86_64-linux"] 358 }) ["x86_64-linux"]
309 ) ++ [ 359 ) ++ [
310 (pkgs.linkFarm "netbootxyz-efi" [ 360 (pkgs.runCommandLocal "utils" {} ''
311 { name = "netboot.xyz.efi"; path = pkgs.netbootxyz-efi; }
312 ])
313 (pkgs.runCommandLocal "memtest" {} ''
314 mkdir $out 361 mkdir $out
315 install -t $out ${pkgs.memtest86plus}/memtest.efi 362 install -m 0444 -t $out \
363 ${ipxe}/ipxe.efi ${ipxe}/i386-ipxe.efi ${ipxe}/undionly.kpxe \
364 ${pkgs.memtest86plus}/memtest.efi ${pkgs.memtest86plus}/memtest.bin
365 install -m 0444 ${sources.netbootxyz-efi.src} $out/netboot.xyz.efi
366 install -m 0444 ${sources.netbootxyz-lkrn.src} $out/netboot.xyz.lkrn
316 '') 367 '')
317 (let 368 (let
318 eostreBuild = (flake.nixosConfigurations.eostre.extendModules { 369 eostreBuild = (flake.nixosConfigurations.eostre.extendModules {
@@ -335,32 +386,39 @@ in {
335 name = "eostre.menu.ipxe"; 386 name = "eostre.menu.ipxe";
336 destination = "/eostre.menu.ipxe"; 387 destination = "/eostre.menu.ipxe";
337 text = '' 388 text = ''
389 #!ipxe
390
391 cpair --background 9 1
392 cpair --background 9 3
393 cpair --background 9 6
394
338 set menu-timeout 5000 395 set menu-timeout 5000
339 396
340 :start 397 :start
341 menu iPXE boot menu for eostre 398 menu iPXE boot menu for eostre
342 item eostre Boot eostre 399 item eostre eostre
343 item memtest memtest86plus 400 item memtest memtest86plus
344 item netboot netboot.xyz 401 item netboot netboot.xyz
345 item shell iPXE shell 402 item shell iPXE shell
346 choose --timeout ''${menu-timeout} --default eostre selected || goto shell 403 choose --timeout ''${menu-timeout} --default eostre selected || goto shell
404 set menu-timeout 0
347 goto ''${selected} 405 goto ''${selected}
348 406
349 :shell 407 :shell
350 shell
351 set menu-timeout 0 408 set menu-timeout 0
409 shell
352 goto start 410 goto start
353 411
354 :eostre 412 :eostre
355 chain ${nfsrootBaseUrl}/eostre/netboot.ipxe 413 chain eostre/netboot.ipxe
356 goto start 414 goto start
357 415
358 :netboot 416 :netboot
359 chain --autofree ${nfsrootBaseUrl}/netboot.xyz.efi 417 iseq ''${platform} efi && chain --autofree netboot.xyz.efi || chain --autofree netboot.xyz.lkrn
360 goto start 418 goto start
361 419
362 :memtest 420 :memtest
363 chain --autofree ${nfsrootBaseUrl}/memtest.efi 421 iseq ''${platform} efi && chain --autofree memtest.efi || chain --autofree memtest.bin
364 goto start 422 goto start
365 ''; 423 '';
366 }) 424 })
@@ -374,14 +432,6 @@ in {
374 after = [ "network.target" ]; 432 after = [ "network.target" ];
375 wantedBy = [ "multi-user.target" ]; 433 wantedBy = [ "multi-user.target" ];
376 serviceConfig.ExecStart = let 434 serviceConfig.ExecStart = let
377 ipxe = pkgs.ipxe.override {
378 additionalTargets = {
379 "bin-i386-efi/ipxe.efi" = "i386-ipxe.efi";
380 };
381 additionalOptions = [
382 "NSLOOKUP_CMD"
383 ];
384 };
385 tftpRoot = pkgs.runCommandLocal "netboot" {} '' 435 tftpRoot = pkgs.runCommandLocal "netboot" {} ''
386 mkdir -p $out 436 mkdir -p $out
387 install -m 0444 -t $out \ 437 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"
115[swayosd] 115[swayosd]
116src.git = "https://github.com/ErikReider/SwayOSD" 116src.git = "https://github.com/ErikReider/SwayOSD"
117fetch.git = "https://github.com/ErikReider/SwayOSD" 117fetch.git = "https://github.com/ErikReider/SwayOSD"
118
119[netbootxyz-efi]
120src.github = "netbootxyz/netboot.xyz"
121fetch.url = "https://github.com/netbootxyz/netboot.xyz/releases/download/$ver/netboot.xyz.efi"
122
123[netbootxyz-lkrn]
124src.github = "netbootxyz/netboot.xyz"
125fetch.url = "https://github.com/netbootxyz/netboot.xyz/releases/download/$ver/netboot.xyz.lkrn"