2022-09-06 17:11:05 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
{
|
2022-09-06 20:29:31 +02:00
|
|
|
sops.secrets = {
|
|
|
|
"mediawiki/postgres".owner = config.users.users.mediawiki.name;
|
|
|
|
"mediawiki/initial_admin".owner = config.users.users.mediawiki.name;
|
|
|
|
"mediawiki/ldapprovider".owner = config.users.users.mediawiki.name;
|
|
|
|
};
|
2022-11-18 17:51:09 +01:00
|
|
|
|
|
|
|
# users.users.mediawiki.extraGroups = [ "postgres" ];
|
2022-09-07 12:42:14 +02:00
|
|
|
nixpkgs.overlays = [
|
|
|
|
(final: prev: {
|
2022-11-18 17:51:09 +01:00
|
|
|
final.config.systemd.services.mediawiki-init.script = ''
|
|
|
|
|
|
|
|
'';
|
|
|
|
})
|
2022-09-07 12:42:14 +02:00
|
|
|
];
|
2022-09-06 17:16:31 +02:00
|
|
|
services = {
|
|
|
|
mediawiki = {
|
|
|
|
enable = true;
|
|
|
|
name = "FSR Wiki";
|
2022-09-06 20:29:31 +02:00
|
|
|
passwordFile = config.sops.secrets."mediawiki/initial_admin".path;
|
2022-09-06 17:16:31 +02:00
|
|
|
database = {
|
|
|
|
type = "postgres";
|
2022-11-18 17:51:09 +01:00
|
|
|
# socket = "/run/postgresql";
|
2022-09-06 20:29:31 +02:00
|
|
|
user = "mediawiki";
|
2022-09-06 17:16:31 +02:00
|
|
|
name = "mediawiki";
|
2022-11-18 17:51:09 +01:00
|
|
|
host = "localhost";
|
|
|
|
port = 5432;
|
2022-09-07 12:42:14 +02:00
|
|
|
passwordFile = config.sops.secrets."mediawiki/postgres".path;
|
2023-05-25 22:58:14 +02:00
|
|
|
createLocally = false;
|
2022-09-06 17:16:31 +02:00
|
|
|
};
|
2022-09-06 20:29:31 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
# virtualHost = {
|
|
|
|
# hostName = "wiki.quitte.tassilo-tanneberger.de";
|
|
|
|
# adminAddr = "root@ifsr.de";
|
|
|
|
# forceSSL = true;
|
|
|
|
# enableACME = true;
|
|
|
|
# };
|
|
|
|
|
2023-05-25 22:58:14 +02:00
|
|
|
httpd.virtualHost = {
|
|
|
|
hostName = "wiki.${config.fsr.domain}";
|
2022-11-18 17:51:09 +01:00
|
|
|
adminAddr = "root@ifsr.de";
|
|
|
|
#forceSSL = true;
|
|
|
|
#enableACME = true;
|
|
|
|
};
|
|
|
|
|
2023-05-25 22:58:14 +02:00
|
|
|
httpd.virtualHost.listen = [
|
2022-11-18 17:51:09 +01:00
|
|
|
{
|
|
|
|
ip = "127.0.0.1";
|
|
|
|
port = 8080;
|
|
|
|
ssl = false;
|
|
|
|
}
|
|
|
|
];
|
2022-09-06 20:29:31 +02:00
|
|
|
|
|
|
|
extraConfig = ''
|
2022-11-18 17:51:09 +01:00
|
|
|
$wgDBport = "5432";
|
|
|
|
$wgDBmwschema = "mediawiki";
|
2022-09-07 12:42:14 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
$wgDBserver = "localhost";
|
|
|
|
$wgDBname = "mediawiki";
|
2022-09-06 20:29:31 +02:00
|
|
|
|
2022-09-07 12:42:14 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
/////// $wgArticlePath = '/$1';
|
2022-09-06 20:29:31 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
// $wgLogo = "https://www.c3d2.de/images/ck.png";
|
|
|
|
$wgEmergencyContact = "root@ifsr.de";
|
|
|
|
$wgPasswordSender = "root@ifsr.de";
|
|
|
|
$wgLanguageCode = "de";
|
2022-09-06 20:29:31 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
$wgGroupPermissions['*']['edit'] = false;
|
|
|
|
$wgGroupPermissions['user']['edit'] = true;
|
|
|
|
$wgGroupPermissions['sysop']['interwiki'] = true;
|
|
|
|
$wgGroupPermissions['sysop']['userrights'] = true;
|
2022-09-06 20:29:31 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
define("NS_INTERN", 100);
|
|
|
|
define("NS_INTERN_TALK", 101);
|
2022-09-06 20:29:31 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
$wgExtraNamespaces[NS_INTERN] = "Intern";
|
|
|
|
$wgExtraNamespaces[NS_INTERN_TALK] = "Intern_Diskussion";
|
2022-09-06 20:29:31 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
$wgGroupPermissions['intern']['move'] = true;
|
|
|
|
$wgGroupPermissions['intern']['move-subpages'] = true;
|
|
|
|
$wgGroupPermissions['intern']['move-rootuserpages'] = true; // can move root userpages
|
|
|
|
$wgGroupPermissions['intern']['read'] = true;
|
|
|
|
$wgGroupPermissions['intern']['edit'] = true;
|
|
|
|
$wgGroupPermissions['intern']['createpage'] = true;
|
|
|
|
$wgGroupPermissions['intern']['createtalk'] = true;
|
|
|
|
$wgGroupPermissions['intern']['writeapi'] = true;
|
|
|
|
$wgGroupPermissions['intern']['upload'] = true;
|
|
|
|
$wgGroupPermissions['intern']['reupload'] = true;
|
|
|
|
$wgGroupPermissions['intern']['reupload-shared'] = true;
|
|
|
|
$wgGroupPermissions['intern']['minoredit'] = true;
|
|
|
|
$wgGroupPermissions['intern']['purge'] = true; // can use ?action=purge without clicking "ok"
|
|
|
|
$wgGroupPermissions['intern']['sendemail'] = true;
|
2022-09-06 20:29:31 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
$wgNamespacePermissionLockdown[NS_INTERN]['*'] = array('intern');
|
|
|
|
$wgNamespacePermissionLockdown[NS_INTERN_TALK]['*'] = array('intern');
|
2022-09-06 20:29:31 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
$wgGroupPermissions['sysop']['deletelogentry'] = true;
|
|
|
|
$wgGroupPermissions['sysop']['deleterevision'] = true;
|
2022-09-06 20:29:31 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
wfLoadExtension('ConfirmEdit/QuestyCaptcha');
|
|
|
|
$wgCaptchaClass = 'QuestyCaptcha';
|
|
|
|
$wgCaptchaQuestions[] = array( 'question' => 'How is C3D2 logo in ascii?', 'answer' => '<<</>>' );
|
2022-09-06 20:29:31 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
$wgEnableAPI = true;
|
|
|
|
$wgAllowUserCss = true;
|
|
|
|
$wgUseAjax = true;
|
|
|
|
$wgEnableMWSuggest = true;
|
2022-09-06 20:29:31 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
//TODO what about $wgUpgradeKey ?
|
2022-09-06 20:29:31 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
$wgScribuntoDefaultEngine = 'luastandalone';
|
2022-09-06 20:29:31 +02:00
|
|
|
|
2022-11-18 17:51:09 +01:00
|
|
|
# LDAP
|
|
|
|
$LDAPProviderDomainConfigs = "${config.sops.secrets."mediawiki/ldapprovider".path}";
|
|
|
|
$wgPluggableAuth_EnableLocalLogin = true;
|
2022-09-06 20:29:31 +02:00
|
|
|
'';
|
2022-09-06 20:35:26 +02:00
|
|
|
extensions = {
|
|
|
|
CiteThisPage = pkgs.fetchzip {
|
|
|
|
url = "https://web.archive.org/web/20220627203556/https://extdist.wmflabs.org/dist/extensions/CiteThisPage-REL1_38-bb4881c.tar.gz";
|
|
|
|
sha256 = "sha256-sTZMCLlOkQBEmLiFz2BQJpWRxSDbpS40EZQ+f/jFjxI=";
|
|
|
|
};
|
|
|
|
ConfirmEdit = pkgs.fetchzip {
|
|
|
|
url = "https://web.archive.org/web/20220627203619/https://extdist.wmflabs.org/dist/extensions/ConfirmEdit-REL1_38-50f4dfd.tar.gz";
|
|
|
|
sha256 = "sha256-babZDzcQDE446TBuGW/olbt2xRbPjk+5o3o9DUFlCxk=";
|
|
|
|
};
|
|
|
|
Lockdown = pkgs.fetchzip {
|
|
|
|
url = "https://web.archive.org/web/20220627203048/https://extdist.wmflabs.org/dist/extensions/Lockdown-REL1_38-1915db4.tar.gz";
|
|
|
|
sha256 = "sha256-YCYsjh/3g2P8oT6IomP3UWjOoggH7jYjiiix7poOYnA=";
|
|
|
|
};
|
|
|
|
intersection = pkgs.fetchzip {
|
|
|
|
url = "https://web.archive.org/web/20220627203336/https://extdist.wmflabs.org/dist/extensions/intersection-REL1_38-8525097.tar.gz";
|
|
|
|
sha256 = "sha256-shgA0XLG6pgikqldOfda40hV9zC1eBp+NalGhevFq2Q=";
|
|
|
|
};
|
|
|
|
Interwiki = pkgs.fetchzip {
|
|
|
|
url = "https://web.archive.org/web/20220617074130/https://extdist.wmflabs.org/dist/extensions/Interwiki-REL1_38-223bbf8.tar.gz";
|
|
|
|
sha256 = "sha256-A4tQuISJNzzXPXJXv9N1jMat1VuZ7khYzk2jxoUqzIk=";
|
|
|
|
};
|
|
|
|
# requires PluggableAuth
|
|
|
|
LDAPAuthentication2 = pkgs.fetchzip {
|
|
|
|
url = "https://web.archive.org/web/20220807184305/https://extdist.wmflabs.org/dist/extensions/LDAPAuthentication2-master-6bc5848.tar.gz";
|
|
|
|
sha256 = "sha256-32xUhahDObS1S9vYJn61HsbpqyFuL0UAsV5+rmH3iWo=";
|
|
|
|
};
|
|
|
|
LDAPProvider = pkgs.fetchzip {
|
|
|
|
url = "https://web.archive.org/web/20220806214957/https://extdist.wmflabs.org/dist/extensions/LDAPProvider-master-80f8cc8.tar.gz";
|
|
|
|
sha256 = "sha256-Y59otw6onknVsjRhyH7L7I0MwnBkvQtuzwpj7c0GZzc=";
|
|
|
|
};
|
|
|
|
ParserFunctions = pkgs.fetchzip {
|
|
|
|
url = "https://web.archive.org/web/20220627203519/https://extdist.wmflabs.org/dist/extensions/ParserFunctions-REL1_38-bc6a7c6.tar.gz";
|
|
|
|
sha256 = "sha256-iDv4VSSFnTKEhvlVQcHHVp2hSWwDbv6jNCq1kOGuswo=";
|
|
|
|
};
|
|
|
|
PluggableAuth = pkgs.fetchzip {
|
|
|
|
url = "https://web.archive.org/web/20220807185047/https://extdist.wmflabs.org/dist/extensions/PluggableAuth-REL1_38-126bad8.tar.gz";
|
|
|
|
sha256 = "sha256-cdJdhj7+qisVVePuyKDu6idoUy0+gYo3zMN0y6weH84=";
|
|
|
|
};
|
2022-09-07 12:42:14 +02:00
|
|
|
#Scribunto = pkgs.fetchzip {
|
|
|
|
# url = "https://web.archive.org/web/20220627202748/https://extdist.wmflabs.org/dist/extensions/Scribunto-REL1_38-9b9271a.tar.gz";
|
|
|
|
# sha256 = "sha256-4sy2ZCnDFzx43WzfS4Enh+I0o0+sFl1RnNV4xGiyU0k=";
|
|
|
|
#};
|
2022-09-06 20:35:26 +02:00
|
|
|
SyntaxHightlight = pkgs.fetchzip {
|
|
|
|
url = "https://web.archive.org/web/20220627203440/https://extdist.wmflabs.org/dist/extensions/SyntaxHighlight_GeSHi-REL1_38-79031cd.tar.gz";
|
|
|
|
sha256 = "sha256-r1NgrhSratleQ356imxmF7KmAANvWvKpAgnLkm8IdKY=";
|
|
|
|
};
|
|
|
|
};
|
2022-09-06 17:11:05 +02:00
|
|
|
};
|
2022-09-06 17:16:31 +02:00
|
|
|
postgresql = {
|
|
|
|
enable = true;
|
2022-09-06 17:32:53 +02:00
|
|
|
ensureUsers = [
|
|
|
|
{
|
2022-11-18 17:51:09 +01:00
|
|
|
name = "mediawiki";
|
|
|
|
ensurePermissions = {
|
|
|
|
"DATABASE \"mediawiki\"" = "ALL PRIVILEGES";
|
|
|
|
};
|
2022-09-06 17:32:53 +02:00
|
|
|
}
|
|
|
|
];
|
|
|
|
ensureDatabases = [
|
|
|
|
"mediawiki"
|
|
|
|
];
|
2022-09-06 17:11:05 +02:00
|
|
|
};
|
2022-09-07 12:42:14 +02:00
|
|
|
nginx = {
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
virtualHosts = {
|
2022-12-17 19:12:41 +01:00
|
|
|
"wiki.${config.fsr.domain}" = {
|
2022-09-07 12:42:14 +02:00
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:8080";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-09-06 17:16:31 +02:00
|
|
|
};
|
|
|
|
systemd.services.mediawiki-pgsetup = {
|
|
|
|
description = "Prepare Mediawiki postgres database";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
after = [ "networking.target" "postgresql.service" ];
|
|
|
|
serviceConfig.Type = "oneshot";
|
|
|
|
|
|
|
|
path = [ pkgs.sudo config.services.postgresql.package ];
|
|
|
|
script = ''
|
2022-09-06 20:29:31 +02:00
|
|
|
sudo -u ${config.services.postgresql.superUser} psql -c "ALTER ROLE mediawiki WITH PASSWORD '$(cat ${config.sops.secrets."mediawiki/postgres".path})'"
|
2022-09-06 17:16:31 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|