# TFTP boot with shared image # Requests store path to install from master # Runs disko and nixos-install { pkgs, lib, config, nodes, ... }@args: with lib; let targets = { "50:46:5d:da:0b:d6" = "node-00"; }; installer = pkgs.nixos [ ./installer.nix { _module.args = { manangerConfig = config; }; } ]; commands = pkgs.symlinkJoin { name = "pxeboot"; paths = mapAttrsToList (mac: name: let node = nodes.${name}.config.system.build; boot = installer.config.system.build; install = pkgs.writers.writeBash "install-${name}" '' set -o errexit set -o nounset set -o pipefail "${node.diskoScript}" "${node.nixos-install}/bin/nixos-install" \ --root /mnt \ --system "${node.toplevel}" \ --no-channel-copy \ --no-root-password \ --verbose reboot ''; in pkgs.writers.writeBashBin "pxe-install-${name}" '' exec ${pkgs.pixiecore}/bin/pixiecore \ boot "${boot.kernel}/bzImage" "${boot.netbootRamdisk}/initrd" \ --cmdline "init=${boot.toplevel}/init loglevel=4 nixos.install=${install}" \ --debug \ --dhcp-no-bind \ --port 64172 \ --status-port 64172 \ "$@" '') targets; }; in { environment.systemPackages = [ commands ]; networking.firewall = { allowedTCPPorts = [ 4011 64172 ]; allowedUDPPorts = [ 67 69 ]; }; }