update and fix netboot
This commit is contained in:
parent
774ea0279a
commit
1150fadfd6
3 changed files with 360 additions and 422 deletions
|
@ -3,6 +3,26 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}: 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 {
|
netboot-x86_64 = pkgs.symlinkJoin {
|
||||||
name = "netboot-x86_64";
|
name = "netboot-x86_64";
|
||||||
paths = [
|
paths = [
|
||||||
|
@ -10,10 +30,16 @@
|
||||||
nixos-config-for-netboot.nixosConfigurations.netboot.config.system.build.kernel
|
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.netbootRamdisk
|
||||||
nixos-config-for-netboot.nixosConfigurations.netboot.config.system.build.netbootIpxeScript
|
nixos-config-for-netboot.nixosConfigurations.netboot.config.system.build.netbootIpxeScript
|
||||||
|
pkgs.edk2-uefi-shell
|
||||||
|
bootIpxeX86Script
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
bootIpxeScript = pkgs.writeText "boot.ipxe" ''
|
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 {
|
netboot = pkgs.stdenvNoCC.mkDerivation {
|
||||||
name = "netboot";
|
name = "netboot";
|
||||||
|
@ -41,20 +67,21 @@ in {
|
||||||
if exists user-class and option user-class = "iPXE" {
|
if exists user-class and option user-class = "iPXE" {
|
||||||
filename "http://192.168.2.1/boot.ipxe";
|
filename "http://192.168.2.1/boot.ipxe";
|
||||||
} elsif substring (option vendor-class-identifier, 0, 10) = "HTTPClient" {
|
} elsif substring (option vendor-class-identifier, 0, 10) = "HTTPClient" {
|
||||||
|
option vendor-class-identifier "HTTPClient";
|
||||||
filename "http://192.168.2.1/x86_64/ipxe.efi";
|
filename "http://192.168.2.1/x86_64/ipxe.efi";
|
||||||
} elsif option client-arch != 00:00 {
|
} elsif option client-arch != 00:00 {
|
||||||
filename "/ipxe.efi";
|
filename "ipxe.efi";
|
||||||
next-server 192.168.2.1;
|
next-server 192.168.2.1;
|
||||||
} else {
|
} else {
|
||||||
filename "/undionly.kpxe";
|
filename "undionly.kpxe";
|
||||||
next-server 192.168.2.1;
|
next-server 192.168.2.1;
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
interfaces = ["br0"];
|
interfaces = ["br0"];
|
||||||
};
|
};
|
||||||
services.tftpd = {
|
services.atftpd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
path = pkgs.ipxe;
|
root = pkgs.ipxe;
|
||||||
};
|
};
|
||||||
services.caddy.virtualHosts."http://192.168.2.1".extraConfig = ''
|
services.caddy.virtualHosts."http://192.168.2.1".extraConfig = ''
|
||||||
import baseConfig
|
import baseConfig
|
||||||
|
|
740
flake.lock
740
flake.lock
File diff suppressed because it is too large
Load diff
|
@ -81,7 +81,10 @@ rec {
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
# inputs.hydra.follows = "hydra";
|
# 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";
|
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
nixpkgs-for-crane.url = "github:NixOS/nixpkgs/3ae365afb80773c3bb67e52294a82e329a9e5be0";
|
nixpkgs-for-crane.url = "github:NixOS/nixpkgs/3ae365afb80773c3bb67e52294a82e329a9e5be0";
|
||||||
|
|
Loading…
Reference in a new issue