pxe boot in flake
This commit is contained in:
45
flake.nix
45
flake.nix
@@ -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:
|
apps = forAllSystems (system:
|
||||||
|
|||||||
Reference in New Issue
Block a user