Home Explore Blog CI



nixpkgs

4th chunk of `nixos/modules/services/web-apps/nextcloud.md`
539c3356d75e2fba365cb501c6c9f98d4ffade21a739123f000000010000094d
  services.nextcloud = {
    enable = true;
    hostName = "localhost";

    /* further, required options */
  };
  services.phpfpm.pools.nextcloud.settings = {
    "listen.owner" = config.services.httpd.user;
    "listen.group" = config.services.httpd.group;
  };
  services.httpd = {
    enable = true;
    adminAddr = "webmaster@localhost";
    extraModules = [ "proxy_fcgi" ];
    virtualHosts."localhost" = {
      documentRoot = config.services.nextcloud.package;
      extraConfig = ''
        <Directory "${config.services.nextcloud.package}">
          <FilesMatch "\.php$">
            <If "-f %{REQUEST_FILENAME}">
              SetHandler "proxy:unix:${config.services.phpfpm.pools.nextcloud.socket}|fcgi://localhost/"
            </If>
          </FilesMatch>
          <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteBase /
            RewriteRule ^index\.php$ - [L]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule . /index.php [L]
          </IfModule>
          DirectoryIndex index.php
          Require all granted
          Options +FollowSymLinks
        </Directory>
      '';
    };
  };
}
```

## Installing Apps and PHP extensions {#installing-apps-php-extensions-nextcloud}

Nextcloud apps are installed statefully through the web interface.
Some apps may require extra PHP extensions to be installed.
This can be configured with the [](#opt-services.nextcloud.phpExtraExtensions) setting.

Alternatively, extra apps can also be declared with the [](#opt-services.nextcloud.extraApps) setting.
When using this setting, apps can no longer be managed statefully because this can lead to Nextcloud updating apps
that are managed by Nix:

```nix
{ config, pkgs, ... }: {
  services.nextcloud.extraApps = with config.services.nextcloud.package.packages.apps; [
    inherit user_oidc calendar contacts;
  ];
}
```

Keep in mind that this is essentially a mirror of the apps from the appstore, but managed in
nixpkgs. This is by no means a curated list of apps that receive special testing on each update.

If you want automatic updates it is recommended that you use web interface to install apps.

## Known warnings {#module-services-nextcloud-known-warnings}

### Logreader application only supports "file" log_type {#module-services-nextcloud-warning-logreader}

Title: Nextcloud Configuration: HTTPD Reverse Proxy, App Installation, and Known Warnings
Summary
This excerpt details configuring Nextcloud with an HTTPD reverse proxy by disabling the default Nginx setup and setting appropriate permissions and socket configurations. It also covers installing Nextcloud apps, emphasizing the use of `phpExtraExtensions` for PHP dependencies and the `extraApps` setting for declaring apps, while noting the limitations of Nix-managed apps compared to stateful web interface installations. It also introduces a section on known warnings.