Archived
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
33 lines
961 B
Nix
33 lines
961 B
Nix
{ vars, ... }:
|
|
|
|
{
|
|
imports = [
|
|
(import ../../modules/beszel/host-token.nix {
|
|
name = "tor-relay";
|
|
sopsFile = ../../secrets/tor-relay.yaml;
|
|
})
|
|
];
|
|
|
|
networking = {
|
|
hostName = "tor-relay";
|
|
useDHCP = false;
|
|
interfaces.${vars.lxcLanInterface}.ipv4.addresses = [{
|
|
address = vars.torRelayIp;
|
|
prefixLength = vars.lanPrefixLength;
|
|
}];
|
|
defaultGateway = { address = vars.lanGateway; interface = vars.lxcLanInterface; };
|
|
nameservers = [ vars.domainControllerIp ];
|
|
};
|
|
|
|
# No networking.hostId: only ZFS-touching hosts need one for pool-import
|
|
# safety, and this host does neither.
|
|
|
|
services.beszel.agent.environment = {
|
|
KEY = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFPR9kwtC4TAeTRu46A7+opZsYpxqkRJ+x/ZyB2GWCeG";
|
|
};
|
|
|
|
# A genuinely new host (not a pre-refactor carry-over), so it tracks the
|
|
# flake's current nixpkgs release rather than being pinned to an older one.
|
|
system.stateVersion = "26.05";
|
|
}
|