anchor.diff:          $wgDebugLogFile = "/tmp/mediawiki_debug_log.txt";
   
           # Database configuration.
  -        $wgDBtype = "postgres";
  -        $wgDBserver = "";
  -        $wgDBuser = "wwwrun";
  -        $wgDBname = "mediawiki";
  +        $wgDBtype = "${config.dbType}";
  +        $wgDBserver = "${config.dbServer}";
  +        $wgDBuser = "${config.dbUser}";
  +        $wgDBpassword = "${config.dbPassword}";
  +        $wgDBname = "${config.dbName}";
   
  -        $wgEmergencyContact = "${serverInfo.serverConfig.adminAddr}";
  -        $wgPasswordSender = $wgEmergencyContact;
  +        # E-mail.
  +        $wgEmergencyContact = "${config.emergencyContact}";
  +        $wgPasswordSender = "${config.passwordSender}";
  +
  +        $wgSitename = "${config.siteName}";
  +
  +        ${config.extraConfig}
         ?>
       '';
   
  
positive.code: 
    options = {
  
      /*
      dbName = mkOption {
        example = "wikidb";
        default = "wikidb";
        description = "
          Name of the wiki database that holds MediaWiki data.
        ";
      };
      
      dbEmergencyContact = mkOption {
        example = "admin@example.com";
        default = "e.dolstra@tudelft.nl";
        description = "
  	In case of emergency, contact this e-mail.
        ";
      };
      
      dbPasswordSender = mkOption {
        example = "passwordrecovery@example.com";
        default = "e.dolstra@tudelft.nl";
        description = "
  	From which e-mail the recovery password for database users will be sent
        ";
      };
  
      dbType = mkOption {
        example = "mysql";
        default = "mysql";
        description = "
  	Which type of database should be used
        ";
      };
  
      dbServer = mkOption {
        example = "10.0.2.2";
        default = "10.0.2.2";
        description = "
  	The location of the database server, e.g. localhost or remote ip address.
        ";
      };
  
      dbPortNumber = mkOption {
        example = "3306";
        default = "3306";
        description = "
  	Portnumber used to connect to the database server. Default: 3306.
        ";
      };
  
      dbUser = mkOption {
        example = "root";
        default = "root";
        description = "
  	The username for accessing the database.
        ";
      };
      
      dbPassword = mkOption {
        example = "foobar";
        default = "";
        description = "
  	The dbUser's password.
        ";
      };
      
      dbSiteName = mkOption {
        example = "wikipedia";
        default = "wiki";
        description = "
  	Name of the wiki site.
        ";
      };
      */
  
      urlPrefix = mkOption {
        example = "/wiki";
  
negative.code:       '';
      };
  
      extraConfig = mkOption {
        default = "";
        example =
          ''
            $wgEnableEmail = false;
          '';
        description = ''
          Any additional text to be appended to MediaWiki's
          configuration file.  This is a PHP script.  For configuration
          settings, see <link xlink:href='http://www.mediawiki.org/wiki/Manual:Configuration_settings'/>.
        '';
      };
  
    };
  
    startupScript = pkgs.writeScript "mediawiki_startup.sh"
      # Initialise the database automagically if we're using a Postgres
      # server on localhost.
      (optionalString (config.dbType == "postgres" && config.dbServer == "") ''
        if ! ${pkgs.postgresql}/bin/psql -l | grep -q ' ${config.dbName} ' ; then
            ${pkgs.postgresql}/bin/createuser --no-superuser --no-createdb --no-createrole "${config.dbUser}" || true
            ${pkgs.postgresql}/bin/createdb "${config.dbName}" -O "${config.dbUser}"
            ${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} "${config.dbUser}" -c "(echo 'CREATE LANGUAGE plpgsql;'; cat ${mediawikiRoot}/maintenance/postgres/tables.sql; echo 'CREATE TEXT SEARCH CONFIGURATION public.default ( COPY = pg_catalog.english );'; echo COMMIT) | ${pkgs.postgresql}/bin/psql ${config.dbName}"
        fi
      '');
  }
  