Netboot: Difference between revisions
Fix advanced script for NixOS 25.05; especially: Failed assertions: - 25.05.git.d19a0d79723b is an invalid value for 'system.stateVersion'; it must be in the format "YY.MM", |
Clarify how to run the second example |
||
| Line 1: | Line 1: | ||
== Building and serving a netboot image == | == Building and serving a netboot image == | ||
This provides an easy way to serve the NixOS installer over netboot, such as when you already have a working NixOS machine and want to install NixOS on a second machine connected to the same network. | |||
=== Example === | === Example === | ||
This example uses [https://github.com/danderson/netboot/tree/main/pixiecore Pixiecore] for hosting, which works in an ordinary network environment with an existing DHCP server. | This example uses [https://github.com/danderson/netboot/tree/main/pixiecore Pixiecore] for hosting, which works in an ordinary network environment with an existing DHCP server. | ||
Pixiecore will notice when the booted machine talks to the network's existing DHCP server, and send netboot information to it at that time. | |||
Create file <code>system.nix</code>: | Create file <code>system.nix</code>: | ||
| Line 44: | Line 47: | ||
in | in | ||
run-pixiecore | run-pixiecore | ||
</syntaxHighlight> | </syntaxHighlight>Building:<syntaxhighlight lang="bash"> | ||
< | |||
# Build pixiecore runner | # Build pixiecore runner | ||
nix build -f system.nix -o /tmp/run-pixiecore | nix build -f system.nix -o /tmp/run-pixiecore | ||
</syntaxhighlight>Running:<syntaxhighlight lang="bash"> | |||
# Open required firewall ports | # Open required firewall ports | ||
sudo iptables -w -I nixos-fw -p udp -m multiport --dports 67,69,4011 -j ACCEPT | sudo iptables -w -I nixos-fw -p udp -m multiport --dports 67,69,4011 -j ACCEPT | ||
| Line 62: | Line 62: | ||
sudo iptables -w -D nixos-fw -p tcp -m tcp --dport 64172 -j ACCEPT | sudo iptables -w -D nixos-fw -p tcp -m tcp --dport 64172 -j ACCEPT | ||
</ | </syntaxhighlight> | ||
=== Another example === | === Another example === | ||
| Line 207: | Line 207: | ||
if legacy then run-dnsmasq else run-pixiecore}} | if legacy then run-dnsmasq else run-pixiecore}} | ||
Building: | |||
< | <syntaxhighlight lang="bash"># Build pixiecore runner | ||
# Build pixiecore runner | |||
nix build -f netboot.nix -o /tmp/run-pixiecore | nix build -f netboot.nix -o /tmp/run-pixiecore | ||
| Line 219: | Line 218: | ||
--arg configuration 'import ./ancient-config.nix' \ | --arg configuration 'import ./ancient-config.nix' \ | ||
--arg legacy true --arg proxynets '["10.2.1.0"]' \ | --arg legacy true --arg proxynets '["10.2.1.0"]' \ | ||
--arg serialconsole true --arg serialport 3 --arg serialspeed 115200 | --arg serialconsole true --arg serialport 3 --arg serialspeed 115200</syntaxhighlight>Running: | ||
* Run the example exactly like the other example further up on the page. | |||
=== See also === | === See also === | ||