Add Unifi Container Module.

This commit is contained in:
Joseph Hanson 2024-07-13 05:23:36 -05:00
parent a55db1401a
commit 25e1a4e2cc
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o
2 changed files with 43 additions and 0 deletions

View file

@ -1,5 +1,6 @@
{
imports = [
./backrest
./unifi
];
}

View file

@ -0,0 +1,42 @@
{ lib, config, ... }:
with lib;
let
app = "unifi";
image = "ghcr.io/goofball222/unifi:8.1.113";
user = "999"; #string
group = "102"; #string
port = 9898; #int
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 {
virtualisation.oci-containers.containers.${app} = {
image = "${image}";
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"
];
};
};
}