aboutsummaryrefslogtreecommitdiff
path: root/modules/services/unifi
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-04-06 12:27:49 -0700
committerFranck Cuny <franck@fcuny.net>2022-04-06 12:27:49 -0700
commit719df0add2cf9c2118cda737ec535d83f2b1e24e (patch)
tree9c684ad999a42f168aa1eee8b9eb1dd83a61d854 /modules/services/unifi
parentimport navidrome with other services (diff)
downloadinfra-719df0add2cf9c2118cda737ec535d83f2b1e24e.tar.gz
refactor unifi to a module
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;