Merge pull request 'update and fix netboot' (#56) from update-netboot into main

Reviewed-on: #56
This commit is contained in:
Charlotte 🦝 Delenk 2023-05-24 11:14:18 +00:00
commit e5b187c425
Signed by: gitea-bot
GPG key ID: C9974EDF9932B558
3 changed files with 391 additions and 422 deletions

View file

@ -3,6 +3,56 @@
pkgs, pkgs,
... ...
}: let }: let
win11Iso = pkgs.stdenv.mkDerivation {
name = "Win11_22H2_EnglishInternational_x64v2.iso";
src = pkgs.emptyDirectory;
buildPhase = ''
echo "Manually add a win11.iso with the correct hash to your store"
exit 1
'';
outputHash = "0dgv9vjv375d5jx80y67ljz5vvpnb0inmia0cifga1zlsp1sq9zz";
outputHashMode = "flat";
outputHashAlgo = "sha256";
};
win11IsoDir = pkgs.stdenv.mkDerivation {
name = "win11";
src = pkgs.emptyDirectory;
buildPhase = "true";
installPhase = ''
mkdir $out
ln -sv ${win11Iso} $out/win11.iso
'';
};
bootIpxeX86Script = pkgs.writeTextDir "boot.ipxe" ''
#!ipxe
:start
menu iPXE boot menu
item --gap -- ------------------------- Operating systems ------------------------------
item --key n linux (N)ixOS (netboot)
item --key w windows (W)indows 11 (installer)
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
:windows
sanboot http://192.168.2.1/x86_64/win11.iso
: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 +60,17 @@
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
win11IsoDir
]; ];
}; };
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 +98,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

File diff suppressed because it is too large Load diff

View file

@ -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";