anchor.diff:    inherit (lib) concatMapStringsSep flatten mapAttrs mapAttrs' mapAttrsToList nameValuePair concatMapStringSep;
   
     eachSite = config.services.dokuwiki;
  -  stateDir = cfg: "/var/lib/dokuwiki/${cfg.hostName}";
   
     user = config.services.nginx.user;
     group = config.services.nginx.group;
  
positive.code:         phpEnv = {
            DOKUWIKI_LOCAL_CONFIG = "${dokuwikiLocalConfig cfg}";
            DOKUWIKI_PLUGINS_LOCAL_CONFIG = "${dokuwikiPluginsLocalConfig cfg}";
          } //optionalAttrs (cfg.usersFile != null) {
            DOKUWIKI_USERS_AUTH_CONFIG = "${cfg.usersFile}";
          } //optionalAttrs (cfg.aclUse) {
            DOKUWIKI_ACL_AUTH_CONFIG = if (cfg.acl != null) then "${dokuwikiAclAuthConfig cfg}" else "${toString cfg.aclFile}";
  
negative.code:     };
  
      systemd.tmpfiles.rules = flatten (mapAttrsToList (hostName: cfg: [
        "d ${cfg.stateDir}/attic 0750 ${user} ${group} - -"
        "d ${cfg.stateDir}/cache 0750 ${user} ${group} - -"
        "d ${cfg.stateDir}/index 0750 ${user} ${group} - -"
        "d ${cfg.stateDir}/locks 0750 ${user} ${group} - -"
        "d ${cfg.stateDir}/media 0750 ${user} ${group} - -"
        "d ${cfg.stateDir}/media_attic 0750 ${user} ${group} - -"
        "d ${cfg.stateDir}/media_meta 0750 ${user} ${group} - -"
        "d ${cfg.stateDir}/meta 0750 ${user} ${group} - -"
        "d ${cfg.stateDir}/pages 0750 ${user} ${group} - -"
        "d ${cfg.stateDir}/tmp 0750 ${user} ${group} - -"
        "f ${cfg.usersFile} 0640 ${user} ${group} - ${pkg hostName cfg}/conf/users.auth.php.dist"
      ]) eachSite);
    };
  }
  