nixos-images/nix/netboot-installer/module.nix

58 lines
1.4 KiB
Nix
Raw Permalink Normal View History

2023-05-14 20:59:46 +02:00
{ config, lib, modulesPath, pkgs, ... }:
{
imports = [
(modulesPath + "/installer/netboot/netboot-minimal.nix")
../installer.nix
../networkd.nix
../serial.nix
../restore-remote-access.nix
2023-05-14 20:59:46 +02:00
];
# We are stateless, so just default to latest.
system.stateVersion = config.system.nixos.version;
system.build.netboot = pkgs.symlinkJoin {
name = "netboot";
paths = with config.system.build; [
netbootRamdisk
kernel
2023-11-02 10:43:57 +01:00
(pkgs.runCommand "kernel-params" { } ''
2023-05-14 20:59:46 +02:00
mkdir -p $out
ln -s "${config.system.build.toplevel}/kernel-params" $out/kernel-params
ln -s "${config.system.build.toplevel}/init" $out/init
'')
];
preferLocalBuild = true;
};
systemd.network.networks."10-uplink" = {
matchConfig.Type = "ether";
networkConfig = {
DHCP = "yes";
EmitLLDP = "yes";
IPv6AcceptRA = "yes";
2023-05-14 20:59:46 +02:00
MulticastDNS = "yes";
LinkLocalAddressing = "yes";
LLDP = "yes";
};
dhcpV4Config = {
UseHostname = false;
ClientIdentifier = "mac";
};
};
networking.hostName = "";
# overrides normal activation script for setting hostname
system.activationScripts.hostname = lib.mkForce ''
# apply hostname from cmdline
for o in $(< /proc/cmdline); do
case $o in
hostname=*)
IFS== read -r -a hostParam <<< "$o"
;;
esac
done
hostname "''${hostParam[1]:-nixos}"
'';
}