diff --git a/nixos/modules/services/web-apps/onlyoffice.nix b/nixos/modules/services/web-apps/onlyoffice.nix index 0d0e01d4f7bc05..9246245bbc6c33 100644 --- a/nixos/modules/services/web-apps/onlyoffice.nix +++ b/nixos/modules/services/web-apps/onlyoffice.nix @@ -32,6 +32,12 @@ in description = "Port the OnlyOffice document server should listen on."; }; + allowLocalConnections = lib.mkOption { + type = lib.types.bool; + default = false; + description = "If true, allows clients with LAN-range IPs to access your instance."; + }; + examplePort = lib.mkOption { type = lib.types.port; default = null; @@ -222,6 +228,13 @@ in cp -r ${cfg.package}/etc/onlyoffice/documentserver/* /run/onlyoffice/config/ chmod u+w /run/onlyoffice/config/default.json + #Allow LAN-range IPs if set true + ${lib.optionalString (cfg.allowLocalConnections) '' + sed -i 's/"allowPrivateIPAddress": false/"allowPrivateIPAddress": true/' /run/onlyoffice/config/default.json + sed -i 's/"allowMetaIPAddress": false/"allowMetaIPAddress": true/' /run/onlyoffice/config/default.json + ''} + + # Allow members of the onlyoffice group to serve files under /var/lib/onlyoffice/documentserver/App_Data chmod g+x /var/lib/onlyoffice/documentserver