about summary refs log tree commit diff
path: root/nixos/modules/programs/winbox.nix
blob: 1337f57839b02e11ff025d1c731b6d27c7cf0fe8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{ config, lib, pkgs, ... }:

let
  cfg  = config.programs.winbox;
in
{
  options.programs.winbox = {
    enable = lib.mkEnableOption ("MikroTik Winbox");
    package = lib.mkPackageOption pkgs "winbox" { };

    openFirewall = lib.mkOption {
      description = ''
        Whether to open ports for the MikroTik Neighbor Discovery protocol. Required for Winbox neighbor discovery.
      '';
      default = false;
      type = lib.types.bool;
    };
  };

  config = lib.mkIf cfg.enable {
    environment.systemPackages = [ cfg.package ];
    networking.firewall.allowedUDPPorts = lib.optionals cfg.openFirewall [ 5678 ];
  };
}