Archived
feat(networking): declare static IPs for all NixOS-managed hosts in flake
Adds static IP configuration to every NixOS host in the flake that has a fixed LAN address, and centralises all network primitives (IPs, gateway, prefix length, interface names) in variables.nix so there is one place to update if any of them change. variables.nix additions: - lanGateway / lanPrefixLength — LAN gateway and /24 prefix, replacing every hardcoded 192.168.2.254 / 24 across host files - lxcLanInterface / vmLanInterface / vmStorageInterface — NIC names for LXC containers (eth0), Proxmox VMs (ens18), and the HA storage NIC (ens19), used as attribute keys so changing the name is a one-line edit - haStoragePrefixLength — /29 for the storage subnet, mirrors haStorageCidr - Per-host IP variables: nixCacheIp (.224), tailscaleRouterIp (.222), torRelayIp (.221), serverIp (.226), dockerIp (.225) host.nix changes: - tailscale-router, tor-relay, nix-cache, pxe-boot: useDHCP = false, static address on eth0 (lxcLanInterface), struct-form defaultGateway (required when using systemd-networkd which LXC containers use) - server, docker: useDHCP = false, static address on ens18 (vmLanInterface), struct-form defaultGateway (works for both scripted networking and networkd) - ha-server-1, ha-server-2: replace hardcoded 192.168.2.254 / 24 / 29 with the new variables; no functional change for these hosts modules/build-types/pxe-boot.nix: - Domain-controller kickstart template: replace hardcoded 192.168.2.138 and 192.168.2.254 with vars.domainControllerIp / vars.lanGateway / vars.lanPrefixLength / vars.homeDomain so the template stays correct if the DC IP or domain is ever changed again Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ULXzafSDwGhmFGnn3LtDSQ
This commit is contained in:
+11
-2
@@ -1,7 +1,16 @@
|
||||
_:
|
||||
{ vars, ... }:
|
||||
|
||||
{
|
||||
networking.hostName = "pxe-boot";
|
||||
networking = {
|
||||
hostName = "pxe-boot";
|
||||
useDHCP = false;
|
||||
interfaces.${vars.lxcLanInterface}.ipv4.addresses = [{
|
||||
address = vars.pxeServerIp;
|
||||
prefixLength = vars.lanPrefixLength;
|
||||
}];
|
||||
defaultGateway = { address = vars.lanGateway; interface = vars.lxcLanInterface; };
|
||||
nameservers = [ vars.domainControllerIp ];
|
||||
};
|
||||
|
||||
# Preserved from the pre-refactor `pxe-boot` target — stateVersion must
|
||||
# never be bumped on an already-installed machine.
|
||||
|
||||
Reference in New Issue
Block a user