about summary refs log tree commit diff
path: root/modules/services/unifi/default.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/services/unifi/default.nix (renamed from hosts/common/server/unifi.nix)8
1 files changed, 7 insertions, 1 deletions
diff --git a/hosts/common/server/unifi.nix b/modules/services/unifi/default.nix
index ab32cec..af7b059 100644
--- a/hosts/common/server/unifi.nix
+++ b/modules/services/unifi/default.nix
@@ -1,6 +1,7 @@
 { config, lib, pkgs, ... }:
 
 let
+  cfg = config.my.services.unifi;
   allowedRules = {
     # https://help.ubnt.com/hc/en-us/articles/218506997
     allowedTCPPorts = [
@@ -8,6 +9,7 @@ let
       8880 # Port for HTTP portal redirect, if guest portal is enabled.
       8843 # Port for HTTPS portal redirect, ditto.
       6789 # Port for UniFi mobile speed test.
+      9130 # Port for the prometheus exporter
     ];
     allowedUDPPorts = [
       3478 # UDP port used for STUN.
@@ -15,7 +17,11 @@ let
     ];
   };
 in {
-  config = {
+  options.my.services.unifi = with lib; {
+    enable = mkEnableOption "Unifi controller";
+  };
+
+  config = lib.mkIf cfg.enable {
     networking.firewall = allowedRules;
     users.users.unifi.group = "unifi";
     users.users.unifi.isSystemUser = true;