Files
garandos/modules/core/network.nix
T
GarandPLG 98069fa8d9 Refactor to pass host vars as arguments
Remove per‑host imports across flake, modules, and profiles, exposing
needed
variables (system, printer settings, consoleKeyMap, etc.) as arguments.
Drop unused printEnable flags from host variable files.
2026-05-24 15:43:18 +02:00

49 lines
1001 B
Nix

{
host,
hostId,
options,
...
}: {
# Defensive assertion for hostname validity (clearer message at eval time)
assertions = [
{
assertion = builtins.match "^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$" host != null;
message = "Invalid hostname '${host}'. Must be 1-63 chars, start/end alphanumeric; allowed middle chars: letters, digits, '-' or '_'.";
}
];
networking = {
hostName = "${host}";
hostId = hostId;
networkmanager.enable = true;
timeServers = options.networking.timeServers.default ++ ["pool.ntp.org"];
firewall = {
enable = true;
allowedTCPPorts = [
22
80
443
59010
59011
8080
];
allowedTCPPortRanges = [
{
from = 1714;
to = 1764;
}
];
allowedUDPPorts = [
59010
59011
];
allowedUDPPortRanges = [
{
from = 1714;
to = 1764;
}
];
};
};
}