Compare commits

..

2 Commits

Author SHA1 Message Date
28d4cf288e pxe boot in flake 2025-07-27 06:27:24 -04:00
bc572173d7 facts: add APIVersion constant 2025-07-24 21:51:46 -04:00
2 changed files with 48 additions and 1 deletions

View File

@@ -7,6 +7,8 @@ import (
"github.com/zcalusic/sysinfo"
)
const APIVersion string = "facts/v1alpha1"
type FactsResponse struct {
APIVersion string `json:"apiVersion"`
CPUInfo sysinfo.CPU `json:"cpu"`
@@ -24,7 +26,7 @@ func GetFacts(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
resp := FactsResponse{
APIVersion: "v1",
APIVersion: APIVersion,
CPUInfo: si.CPU,
BoardInfo: si.Board,
DeviceInfo: si.Product,

View File

@@ -64,6 +64,51 @@
})
];
};
boot-env-pxe = let
systemConfig = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
({modulesPath, ...}: {
imports = [
(modulesPath + "/installer/netboot/netboot-minimal.nix")
];
system.stateVersion = "25.05";
boot.initrd.kernelModules = ["hv_vmbus" "hv_storvsc"]; # Hyper-V Support
# Disable unneeded features
##boot.loader.grub.enable = true; # Not needed as iso-image.nix in modulesPath defines these and cause conflict
##boot.loader.grub.device = "nodev";
documentation.enable = false;
fonts.fontconfig.enable = false;
services.udisks2.enable = false;
networking.firewall.enable = false; # Technically we COULD use the firewall, but given that this is a network-dependent, one-time-use service, it would cause more issues
services.getty.autologinUser = nixpkgs.lib.mkForce "root";
environment.systemPackages = [ clientPackage ];
environment.etc."profile.local".text = ''
client
'';
})
];
}; in pkgs.stdenv.mkDerivation {
name = "boot-env-pxe";
buildCommand = ''
mkdir -p $out
cp -r ${systemConfig.config.system.build.kernel}/bzImage $out/kernel
cp -r ${systemConfig.config.system.build.netbootRamdisk} $out/initrd
cat <<EOF > $out/boot.ipxe
#!ipxe
imgfree
kernel http://127.0.0.1:8081/kernel init=${systemConfig.config.system.build.toplevel}/init initrd=initrd ${toString systemConfig.config.boot.kernelParams} ''${cmdline}
initrd http://127.0.0.1:8081/initrd
boot
EOF
'';
};
});
apps = forAllSystems (system: