update and fix netboot

This commit is contained in:
Charlotte 🦝 Delenk 2023-05-23 14:34:44 +01:00
parent 774ea0279a
commit 1150fadfd6
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
3 changed files with 360 additions and 422 deletions

View file

@ -3,6 +3,26 @@
pkgs,
...
}: let
bootIpxeX86Script = pkgs.writeTextDir "boot.ipxe" ''
#!ipxe
:start
menu iPXE boot menu
item --gap -- ------------------------- Operating systems ------------------------------
item --key n linux (N)ixOS (netboot)
item --gap -- ----------------------------- Utilities ----------------------------------
item --key e ext (E)xit
item --key s shell EFI (S)hell
choose version && goto ${"$"}{version} || goto start
:linux
chain http://192.168.2.1/x86_64/netboot.ipxe
:shell
chain http://192.168.2.1/x86_64/shell.efi
:ext
exit
'';
netboot-x86_64 = pkgs.symlinkJoin {
name = "netboot-x86_64";
paths = [
@ -10,10 +30,16 @@
nixos-config-for-netboot.nixosConfigurations.netboot.config.system.build.kernel
nixos-config-for-netboot.nixosConfigurations.netboot.config.system.build.netbootRamdisk
nixos-config-for-netboot.nixosConfigurations.netboot.config.system.build.netbootIpxeScript
pkgs.edk2-uefi-shell
bootIpxeX86Script
];
};
bootIpxeScript = pkgs.writeText "boot.ipxe" ''
chain http://192.168.2.1/${"$"}{buildarch}/netboot.ipxe
#!ipxe
set arch ${"$"}{buildarch}
iseq ${"$"}{arch} i386 && cpuid --ext 29 && set arch x86_64 ||
chain http://192.168.2.1/${"$"}{arch}/boot.ipxe
'';
netboot = pkgs.stdenvNoCC.mkDerivation {
name = "netboot";
@ -41,20 +67,21 @@ in {
if exists user-class and option user-class = "iPXE" {
filename "http://192.168.2.1/boot.ipxe";
} elsif substring (option vendor-class-identifier, 0, 10) = "HTTPClient" {
option vendor-class-identifier "HTTPClient";
filename "http://192.168.2.1/x86_64/ipxe.efi";
} elsif option client-arch != 00:00 {
filename "/ipxe.efi";
filename "ipxe.efi";
next-server 192.168.2.1;
} else {
filename "/undionly.kpxe";
filename "undionly.kpxe";
next-server 192.168.2.1;
}
'';
interfaces = ["br0"];
};
services.tftpd = {
services.atftpd = {
enable = true;
path = pkgs.ipxe;
root = pkgs.ipxe;
};
services.caddy.virtualHosts."http://192.168.2.1".extraConfig = ''
import baseConfig

File diff suppressed because it is too large Load diff

View file

@ -81,7 +81,10 @@ rec {
inputs.nixpkgs.follows = "nixpkgs";
# inputs.hydra.follows = "hydra";
};
nixos-config-for-netboot.url = "github:DarkKirb/nixos-config/c9c3d16b23042a25f504a6d71e7075318f1137f8";
nixos-config-for-netboot = {
url = "github:DarkKirb/nixos-config/09d7bc6e18f5570522c1c6ba1c6a9db27f933c7a";
inputs.nixos-config-for-netboot.follows = "nixos-config-for-netboot";
};
nixos-hardware.url = "github:NixOS/nixos-hardware";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-for-crane.url = "github:NixOS/nixpkgs/3ae365afb80773c3bb67e52294a82e329a9e5be0";