MediaWiki: Difference between revisions

From NixOS Wiki
imported>Nix
m add Software/Applications subcategory
imported>Alyaeanyx
Added info about module
Line 1: Line 1:
[https://www.mediawiki.org/wiki/MediaWiki MediaWiki] is available in [[NixOS]].
[https://www.mediawiki.org/wiki/MediaWiki MediaWiki] is available as a [[Module|NixOS module]].
Sample configuration:
<syntaxhighlight>
services.mediawiki = {
  enable = true;
  name = "Sample MediaWiki instance";
  virtualHost = {
    hostName = "example.com";
    adminAddr = "admin@example.com";
  };
  passwordFile = "/var/mediawiki/passwordFile"; # put the initial password for the admin account here
  extraConfig = ''
    # Disable anonymous editing
    $wgGroupPermissions['*']['edit'] = false;
  '';


https://search.nixos.org/packages?query=mediawiki
  extensions = {
    VisualEditor = pkgs.fetchzip {
        url = "https://extdist.wmflabs.org/dist/extensions/VisualEditor-REL1_37-3aeea63.tar.gz";
        sha256 = "sha256:0y7yysnm64vclyj0nh18ibsbrwsycdi7f8mf8j1b991qggqnclys";
      };
  };
};
</syntaxhighlight>


https://search.nixos.org/options?query=mediawiki
By default, the <code>services.mediawiki</code> module creates a <code>services.httpd.virtualHost</code> which can be configured via the `services.mediawiki.virtualHost` submodule. If you are using another web server, you can configure MediaWiki for a reverse proxy with the <code>services.mediawiki.virtualHost.listen</code> option:
<syntaxhighlight>
services.mediawiki.virtualHost.listen = [
  ip = "127.0.0.1";
  port = 8080;
  ssl = false;
} ];
</syntaxhighlight>


<s>
== Overview ==


At the time of writing the mediawiki expression exists as an apache subservice.  In the future this the build part of the expression will need to move to its own package.  This will require a change in the future and we will endeavor to have a deprecation message inform you of the syntax changes required to migrate when the time comes.


===installation===
There are a few things you need to configure in order to use the existing tooling.  Install your database of choice and create the database user and password as required.
For the simplest default configuration, in <code>configuration.nix</code>, add: <syntaxhighlight lang=nix>{
  ...
  services.httpd.extraSubservices =
    [ { serviceType = "mediawiki";
        siteName = "your.sitename.here";
        id = "unique_identifier";
        dbName = "dbname";
        dbUser = "dbusername";
        dbPassword = "redacted";
        defaultSkin = "MonoBook";
        extraConfig = ''
          wfLoadSkin( 'MonoBook' );
          wfLoadExtension( 'WikiEditor' );
          $wgDefaultUserOptions['usebetatoolbar'] = 1;
        '';
      }
    ];
  ...
}</syntaxhighlight>
=== Known Issues ===
There are several known issues with the package which will be remediated when we re-factor it out of a subService.  To name a few:
# The database creation scripts run as 'root' for postgresql and fail.  To fix this you can temporarily grant root dba access, run your first installation and revoke.
# It is ideal if we can have a working, secure, default installation without having to fall-back to extraConfig.  We're not there yet.
</s>


[[Category:Guide]]
[[Category:Guide]]
[[Category:Applications]]
[[Category:Applications]]

Revision as of 01:19, 11 January 2022

MediaWiki is available as a NixOS module. Sample configuration:

services.mediawiki = {
  enable = true;
  name = "Sample MediaWiki instance";
  virtualHost = {
    hostName = "example.com";
    adminAddr = "admin@example.com";
  };
  passwordFile = "/var/mediawiki/passwordFile"; # put the initial password for the admin account here
  extraConfig = ''
    # Disable anonymous editing
    $wgGroupPermissions['*']['edit'] = false;
  '';

  extensions = {
    VisualEditor = pkgs.fetchzip {
        url = "https://extdist.wmflabs.org/dist/extensions/VisualEditor-REL1_37-3aeea63.tar.gz";
        sha256 = "sha256:0y7yysnm64vclyj0nh18ibsbrwsycdi7f8mf8j1b991qggqnclys";
      };
  };
};

By default, the services.mediawiki module creates a services.httpd.virtualHost which can be configured via the `services.mediawiki.virtualHost` submodule. If you are using another web server, you can configure MediaWiki for a reverse proxy with the services.mediawiki.virtualHost.listen option:

services.mediawiki.virtualHost.listen = [
  ip = "127.0.0.1";
  port = 8080;
  ssl = false;
} ];