diff --git a/nixos/modules/nixos/containers/default.nix b/nixos/modules/nixos/containers/default.nix index 1f6a0d1..2a7d808 100644 --- a/nixos/modules/nixos/containers/default.nix +++ b/nixos/modules/nixos/containers/default.nix @@ -1,5 +1,6 @@ { imports = [ ./backrest + ./unifi ]; } diff --git a/nixos/modules/nixos/containers/unifi/default.nix b/nixos/modules/nixos/containers/unifi/default.nix new file mode 100644 index 0000000..b91cbd4 --- /dev/null +++ b/nixos/modules/nixos/containers/unifi/default.nix @@ -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" + ]; + }; + }; +}