summaryrefslogtreecommitdiffstats
path: root/modules/iana.nix
blob: a63af8ab94e618eafd5912f46e5b7b3ce70faf6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{ config, lib, ... }: {
  options.tv.iana.services = lib.mkOption {
    default = let
      inherit (config.krebs.iana-etc) services;
    in
      builtins.foldl'
        (result: port: lib.recursiveUpdate result {
          ${services.${port}.tcp.name or null}.tcp.port = lib.toInt port;
          ${services.${port}.udp.name or null}.udp.port = lib.toInt port;
        })
        {}
        (builtins.attrNames services);
    readOnly = true;
    type = lib.types.attrsOf (lib.types.submodule {
      options.tcp.port = lib.mkOption {
        type = lib.types.port;
      };
      options.udp.port = lib.mkOption {
        type = lib.types.port;
      };
    });
  };
}