<linkxlink:href="https://nextcloud.com/">Nextcloud</link> is an open-source, self-hostable cloud platform. The server setup can be automated using <linklinkend="opt-services.nextcloud.enable">services.nextcloud</link>. A desktop client is packaged at <literal>pkgs.nextcloud-client</literal>.
Nextcloud is a PHP-based application which requires an HTTP server (<literal><linklinkend="opt-services.nextcloud.enable">services.nextcloud</link></literal> optionally supports <literal><linklinkend="opt-services.nginx.enable">services.nginx</link></literal>) and a database (it's recommended to use <literal><linklinkend="opt-services.postgresql.enable">services.postgresql</link></literal>).
The options <literal>hostName</literal> and <literal>nginx.enable</literal> are used internally to configure an HTTP server using <literal><linkxlink:href="https://php-fpm.org/">PHP-FPM</link></literal> and <literal>nginx</literal>. The <literal>config</literal> attribute set is used by the imperative installer and all values are written to an additional file to ensure that changes can be applied by changing the module's options.
In case the application serves multiple domains (those are checked with <literal><linkxlink:href="http://php.net/manual/en/reserved.variables.server.php">$_SERVER['HTTP_HOST']</link></literal>) it's needed to add them to <literal><linklinkend="opt-services.nextcloud.config.extraTrustedDomains">services.nextcloud.config.extraTrustedDomains</link></literal>.
Auto updates for Nextcloud apps can be enabled using <literal><linklinkend="opt-services.nextcloud.autoUpdateApps.enable">services.nextcloud.autoUpdateApps</link></literal>.
Unfortunately Nextcloud appears to be very stateful when it comes to managing its own configuration. The config file lives in the home directory of the <literal>nextcloud</literal> user (by default <literal>/var/lib/nextcloud/config/config.php</literal>) and is also used to track several states of the application (e.g. whether installed or not).
All configuration parameters are also stored in <literal>/var/lib/nextcloud/config/override.config.php</literal> which is generated by the module and linked from the store to ensure that all values from <literal>config.php</literal> can be modified by the module. However <literal>config.php</literal> manages the application's state and shouldn't be touched manually because of that.