anchor.diff:                fi
               done
   
  -            ln -sf ${overrideConfig} ${cfg.home}/config/override.config.php
  +            ln -sf ${overrideConfig} ${datadir}/config/override.config.php
   
               # Do not install if already installed
  -            if [[ ! -e ${cfg.home}/config/config.php ]]; then
  +            if [[ ! -e ${datadir}/config/config.php ]]; then
                 ${occInstallCmd}
               fi
   
               ${occ}/bin/nextcloud-occ upgrade
   
               ${occ}/bin/nextcloud-occ config:system:delete trusted_domains
  +
  +            ${optionalString (cfg.extraAppsEnable && cfg.extraApps != { }) ''
  +                # Try to enable apps (don't fail when one of them cannot be enabled , eg. due to incompatible version)
  +                ${occ}/bin/nextcloud-occ app:enable ${builtins.concatStringsSep " " ( lib.mapAttrsToList (name: target: "${name}") cfg.extraApps)} || true
  +            ''}
  +
               ${occSetTrustedDomainsCmd}
             '';
             serviceConfig.Type = "oneshot";
             serviceConfig.User = "nextcloud";
           };
           nextcloud-cron = {
  -          environment.NEXTCLOUD_CONFIG_DIR = "${cfg.home}/config";
  +          environment.NEXTCLOUD_CONFIG_DIR = "${datadir}/config";
             serviceConfig.Type = "oneshot";
             serviceConfig.User = "nextcloud";
             serviceConfig.ExecStart = "${phpPackage}/bin/php -f ${cfg.package}/cron.php";
  
positive.code: 
              # create nextcloud directories.
              # if the directories exist already with wrong permissions, we fix that
              for dir in ${cfg.home}/config ${cfg.home}/data ${cfg.home}/store-apps; do
                if [ ! -e $dir ]; then
                  install -o nextcloud -g nextcloud -d $dir
                elif [ $(stat -c "%G" $dir) != "nextcloud" ]; then
  
negative.code: let
    cfg = config.services.nextcloud;
    fpm = config.services.phpfpm.pools.nextcloud;
    datadir = if cfg.datadir == null then "${cfg.home}" else "${cfg.datadir}";
  
    phpPackage = cfg.phpPackage.buildEnv {
      extensions = { enabled, all }:
  