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

58 lines
1.4 KiB
Nix
Raw Normal View History

2025-03-06 09:51:33 -06:00
{
lib,
config,
...
}:
with lib; let
2024-07-13 05:23:36 -05:00
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}";
in
2025-03-06 09:51:33 -06:00
# persistentFolder = "${config.mySystem.persistentFolder}/var/lib/${appFolder}";
{
options.mySystem.services.${app} = {
enable = mkEnableOption "${app}";
};
2024-07-13 05:23:36 -05:00
2025-03-06 09:51:33 -06:00
config = mkIf cfg.enable {
networking.firewall.interfaces = {
enp130s0f0 = {
allowedTCPPorts = [8443];
};
podman0 = {
allowedTCPPorts = [
8080
8443
8880
8843
];
allowedUDPPorts = [3478];
};
2024-09-01 16:39:07 -05:00
};
2025-03-06 09:51:33 -06:00
virtualisation.oci-containers.containers.${app} = {
image = "ghcr.io/goofball222/unifi:${version}";
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"
2024-12-27 21:30:25 -06:00
];
2024-07-13 05:23:36 -05:00
};
};
2025-03-06 09:51:33 -06:00
}