nixos-config/nixos/modules/networking/ports.nix

41 lines
824 B
Nix
Raw Normal View History

2024-11-28 01:14:34 +08:00
{ config, lib, ... }:
with lib;
let
cfg = config.networking.ports;
noCollision = l: length (unique l) == length l;
in
{
options.networking.ports = mkOption {
type = with types; attrsOf port;
default = {
2024-12-07 02:08:39 +08:00
# standard ports
2024-11-28 01:14:34 +08:00
http = 80;
https = 443;
2024-12-07 02:08:39 +08:00
socks = 1080;
2024-11-28 01:14:34 +08:00
ssh = 2222;
2024-12-07 02:08:39 +08:00
# local ports
enthalpy-gost = 3000;
2024-12-15 01:20:55 +08:00
ntfy = 4000;
2024-12-15 02:52:27 +08:00
keycloak = 4010;
2024-12-17 16:32:59 +08:00
miniflux = 4020;
2024-12-18 16:36:47 +08:00
matrix-synapse = 4030;
2024-12-07 02:08:39 +08:00
# public ports
2024-11-28 01:14:34 +08:00
enthalpy-ipsec = 13000;
enthalpy-wireguard-reimu-aston = 13101;
2024-11-28 01:14:34 +08:00
};
readOnly = true;
description = ''
A mapping of network ports, each identified by a unique name.
'';
};
config = {
assertions = singleton {
assertion = noCollision (attrValues cfg);
message = "port collision";
};
};
}