mochi/.archive/modules/nixos/containers/unifi/default.nix

50 lines
1.3 KiB
Nix
Raw Permalink Normal View History

2024-07-13 05:23:36 -05:00
{ lib, config, ... }:
with lib;
let
app = "unifi";
2024-08-02 22:33:57 -05:00
# renovate: depName=goofball222/unifi datasource=github-releases
version = "8.4.62";
2024-07-13 05:23:36 -05:00
cfg = config.mySystem.services.${app};
appFolder = "/eru/containers/volumes/${app}";
# persistentFolder = "${config.mySystem.persistentFolder}/var/lib/${appFolder}";
in
{
options.mySystem.services.${app} = {
enable = mkEnableOption "${app}";
};
config = mkIf cfg.enable {
2024-09-01 16:39:07 -05:00
networking.firewall.interfaces = {
enp130s0f0 = {
allowedTCPPorts = [ 8443 ];
};
podman0 = {
allowedTCPPorts = [ 8080 8443 8880 8843 ];
allowedUDPPorts = [ 3478 ];
};
2024-07-14 06:42:18 -05:00
};
2024-07-13 05:23:36 -05:00
virtualisation.oci-containers.containers.${app} = {
2024-08-02 11:35:11 -05:00
image = "ghcr.io/goofball222/unifi:${version}";
2024-07-13 05:23:36 -05:00
autoStart = true;
ports = [
"3478:3478/udp" # STUN
"8080:8080" # inform controller
"8443:8443" # https
"8880:8880" # HTTP portal redirect
"8843:8843" # HTTPS portal redirect
];
environment = {
TZ = "America/Chicago";
RUNAS_UID0 = "false";
PGID = "102";
PUID = "999";
};
volumes = [
"${appFolder}/cert:/usr/lib/unifi/cert"
"${appFolder}/data:/usr/lib/unifi/data"
"${appFolder}/logs:/usr/lib/unifi/logs"
];
};
};
}