{ ipxe, lib, writeText, stage2-url ? "http://[fe80::b007:b007]/\${netX/mac}/stage2.ipxe", }: { minimal = ipxe.override { embedScript = "..."; # TODO pname = "ipxe-minimal"; enabledOptions = []; preConfigure = '' sed -i \ '/^#define\s\+\<[A-Z0-9_]\+\>\s*\(\/\*.*\*\/\)\?$/ { /CONFIG_GENERAL_H/! { s/^/\/\// } }' \ src/config/general.h ''; }; with-script = (ipxe.override { embedScript = writeText "ipxe-shim-script" '' #!ipxe echo stage1: chainloading from ${stage2-url}... ifconf --configurator ipv6 --timeout 1000 || goto try-v4 goto try-boot :try-v4 echo stage1: failed to bring IPv6 up, trying DHCP... ifconf --configurator dhcp --timeout 1000 || goto fail :try-boot isset ''${netX/gateway} && isset ''${syslog} || set syslog ''${netX/gateway} isset ''${netX/gateway6} && isset ''${syslog6} || set syslog6 ''${netX/gateway6} show syslog show syslog6 echo stage1: network up route || chain --timeout 10000 --replace ${stage2-url} || :fail echo stage1: failed, rebooting in 5s... sleep 5 reboot --warm ''; }).overrideAttrs (finalAtrs: prevAttrs: { pname = "ipxe-with-embedded-script"; enabledOptions = [ "DOWNLOAD_PROTO_HTTP" "NET_PROTO_IPV4" "NET_PROTO_IPV6" "REBOOT_CMD" ]; preConfigure = '' sed -i \ 's/^\s*#define\s\+LOG_LEVEL\>.*$/#define LOG_LEVEL LOG_ALL/; /#define\s\+CONSOLE_SYSLOG\>/ { s/\/\/#/#/; }' \ src/config/console.h ''; }); }