2021-01-12 18:20:49 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
2021-01-12 23:21:19 +00:00
|
|
|
let
|
|
|
|
unstable = import (import ../../../nix/sources.nix).nixpkgs-unstable {};
|
|
|
|
in {
|
2021-01-12 18:20:49 +00:00
|
|
|
containers.lantifa = {
|
|
|
|
autoStart = true;
|
|
|
|
privateNetwork = true;
|
|
|
|
hostAddress6 = "fd00::42:14";
|
|
|
|
localAddress6 = "fd00::42:15";
|
|
|
|
|
|
|
|
config = {config, pkgs, ... }: {
|
2021-01-13 18:48:06 +00:00
|
|
|
networking.hosts."::1" = [ "wiki.lantifa.org" ];
|
2021-01-15 22:45:34 +00:00
|
|
|
networking.firewall.enable = false;
|
2021-01-12 18:20:49 +00:00
|
|
|
users.users.mediawiki.extraGroups = [ "keys" ];
|
|
|
|
|
|
|
|
services.mediawiki = {
|
|
|
|
enable = true;
|
|
|
|
name = "LANtifa";
|
2021-01-12 23:21:19 +00:00
|
|
|
package = unstable.mediawiki;
|
2021-01-12 18:20:49 +00:00
|
|
|
database.createLocally = true;
|
|
|
|
passwordFile = "/var/lib/mediawiki/mediawiki-password";
|
2021-01-13 18:48:06 +00:00
|
|
|
extraConfig = let
|
|
|
|
wikidb = pkgs.fetchzip {
|
2021-04-27 09:09:42 +00:00
|
|
|
url = "http://www.kennel17.co.uk/uploads/testwiki/archive/e/e9/20210407232657%21WikiDB.zip";
|
2021-01-13 18:48:06 +00:00
|
|
|
sha256 = "0d4f2ygglz4w515a7lgw59500q3xmr92xxhsmh8p204yaa769x8v";
|
|
|
|
};
|
|
|
|
in ''
|
2021-01-15 10:05:42 +00:00
|
|
|
// Configure short URLs
|
|
|
|
$wgScriptPath = "";
|
|
|
|
$wgArticlePath = "/wiki/$1";
|
|
|
|
$wgUsePathInfo = true;
|
|
|
|
|
2021-01-13 18:48:06 +00:00
|
|
|
require_once('${wikidb}/WikiDB.php');
|
2021-01-12 22:14:05 +00:00
|
|
|
$wgExtraNamespaces = array( 100 => "Table", 101 => "Table_Talk",);
|
|
|
|
$wgWikiDBNamespaces = 100;
|
2021-01-13 17:18:16 +00:00
|
|
|
$wgGroupPermissions['user']['writeapi'] = true;
|
|
|
|
$wgDefaultUserOptions['visualeditor-enable'] = 1;
|
2021-01-17 23:37:20 +00:00
|
|
|
$wgLogo = "images/c/c5/LantifaLogoFem0.3.png";
|
2021-01-15 09:33:57 +00:00
|
|
|
|
|
|
|
// PageForms config
|
|
|
|
$wgGroupPermissions['*']['viewedittab'] = false;
|
|
|
|
$wgGroupPermissions['user']['viewedittab'] = true;
|
|
|
|
|
2021-01-17 21:31:37 +00:00
|
|
|
// Moderation setting
|
|
|
|
$wgModerationNotificationEnable = true;
|
2021-01-17 23:37:20 +00:00
|
|
|
$wgModerationEmail = "wiki_mod@lantifa.org";
|
2021-01-17 21:31:37 +00:00
|
|
|
$wgLogRestrictions["newusers"] = 'moderation';
|
|
|
|
|
2021-01-15 09:33:57 +00:00
|
|
|
// intersection / DynamicPageList config
|
|
|
|
$wgDLPMaxCacheTime = 5 * 60;
|
2021-01-13 18:48:06 +00:00
|
|
|
'';
|
2021-01-12 22:14:05 +00:00
|
|
|
|
2021-01-13 18:48:06 +00:00
|
|
|
extensions = {
|
2021-01-13 16:37:35 +00:00
|
|
|
TemplateData = null;
|
2021-01-13 17:18:16 +00:00
|
|
|
VisualEditor = null;
|
2021-01-13 16:37:35 +00:00
|
|
|
InputBox = null;
|
2021-01-17 23:37:20 +00:00
|
|
|
Moderation = pkgs.fetchzip {
|
|
|
|
url = "https://github.com/edwardspec/mediawiki-moderation/archive/v1.4.20.tar.gz";
|
|
|
|
sha256 = "1k0z44jfqsxzwy6jjz3yfibiq8wi845d5iwwh8j3yijn2854fj0i";
|
|
|
|
};
|
2021-01-15 09:33:57 +00:00
|
|
|
intersection = pkgs.fetchzip { # This is the DynamicPageList extension
|
2021-06-11 17:08:22 +00:00
|
|
|
url = "https://extdist.wmflabs.org/dist/extensions/intersection-REL1_35-1adb683.tar.gz";
|
|
|
|
sha256 = "0jh3b22vq1ml3kdj0hhhbfjsilpw39bcjbnkajgx1pcvr7haxld7";
|
2021-01-15 09:33:57 +00:00
|
|
|
};
|
|
|
|
PageForms = pkgs.fetchzip {
|
|
|
|
url = "https://github.com/wikimedia/mediawiki-extensions-PageForms/archive/5.0.1.zip";
|
|
|
|
sha256 = "172m7p941fbkl29h5bhanx3dn42jfmzgyvgmgm2lgdbmkawwly96";
|
|
|
|
};
|
2021-01-12 22:14:05 +00:00
|
|
|
};
|
2021-01-12 18:20:49 +00:00
|
|
|
|
|
|
|
virtualHost = {
|
|
|
|
hostName = "wiki.lantifa.org";
|
2021-01-13 18:48:06 +00:00
|
|
|
listen = [ { port = 80; } ];
|
2021-01-12 18:20:49 +00:00
|
|
|
adminAddr = "admin@hacc.space";
|
2021-01-15 10:05:42 +00:00
|
|
|
extraConfig = ''
|
|
|
|
RewriteEngine On
|
|
|
|
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L]
|
|
|
|
RewriteRule ^/*$ %{DOCUMENT_ROOT}/index.php [L]
|
|
|
|
'';
|
2021-01-12 18:20:49 +00:00
|
|
|
};
|
|
|
|
};
|
2021-02-15 07:23:23 +00:00
|
|
|
|
|
|
|
services.mysqlBackup = {
|
|
|
|
enable = true;
|
|
|
|
databases = [ "mediawiki" ];
|
|
|
|
calendar = "*-*-* 23:45:00";
|
|
|
|
};
|
2021-01-12 18:20:49 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."wiki.lantifa.org" = {
|
2021-01-13 18:48:06 +00:00
|
|
|
locations."/".proxyPass = "http://[" + config.containers.lantifa.localAddress6 + "]";
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
};
|
2021-01-12 18:20:49 +00:00
|
|
|
}
|