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

53 lines
1.1 KiB
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
smtp = 25;
dns = 53;
2024-11-28 01:14:34 +08:00
http = 80;
https = 443;
smtp-tls = 465;
smtp-submission = 587;
imap-tls = 993;
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-18 18:54:19 +08:00
heisenbridge = 4031;
2024-12-19 00:09:09 +08:00
mautrix-telegram = 4032;
rspamd-controller = 4040;
rspamd-redis = 4041;
caddy-admin = 4050;
2024-12-21 20:04:41 +08:00
prometheus = 4060;
prometheus-node-exporter = 4070;
2024-12-07 02:08:39 +08:00
# public ports
enthalpy-wireguard-reimu-aston = 13101;
enthalpy-ipsec = 14000;
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";
};
};
}