{ config, pkgs, lib, ... }: let cfg = config.services.vm_onlyoffice; in { options.services.vm_onlyoffice = { enable = lib.mkEnableOption "Enable OnlyOffice service"; pgsql_ip = lib.mkOption { type = lib.types.str; description = "The PostgreSQL host IP address"; }; }; config = lib.mkIf cfg.enable { services = { onlyoffice = { enable = true; hostname = "office.le43.eu"; port = 8000; postgresName = "onlyoffice"; postgresHost = "${cfg.pgsql_ip}"; postgresUser = "onlyoffice"; postgresPasswordFile = "/run/secrets/onlyoffice/office-dbpass"; jwtSecretFile = "/run/secrets/onlyoffice/office-jwtpass"; }; }; networking.firewall.allowedTCPPorts = [ 8000 ]; }; }