1
0
Fork 0
forked from fabian/nix

modularize media wiki

This commit is contained in:
Fabian Montero 2026-02-03 14:46:33 -06:00
parent d08b8011e4
commit f791a2b208
Signed by untrusted user: fabian
GPG key ID: 8036F30EDBAC8447
6 changed files with 167 additions and 75 deletions

View file

@ -37,9 +37,57 @@ with lib; {
};
};
trivium.soju = {
enable = true;
fullyQualifiedDomain = "soju.posixlycorrect.com";
trivium = {
soju = {
enable = true;
fullyQualifiedDomain = "soju.posixlycorrect.com";
};
mediawiki = {
enable = true;
hostName = "wiki.posixlycorrect.com";
name = "posixlycorrect wiki";
passwordFile = "/run/keys/mediawiki-password";
skins = {
citizen = "${flakes.mediawikiSkinCitizen}";
};
extraConfig = ''
# Disable anonymous editing and account creation
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['createaccount'] = false;
$wgDefaultSkin = 'citizen';
$wgDefaultMobileSkin = 'citizen';
$wgCitizenThemeDefault = 'dark';
$wgCitizenShowPageTools = 'login';
$wgLogos = [
'icon' => "https://posixlycorrect.com/favicon.png",
'1x' => "https://posixlycorrect.com/favicon.png",
'2x' => "https://posixlycorrect.com/favicon.png",
];
$wgEnableEmail = false; #TODO: arreglar esto
$wgNoReplyAddress = 'mediawiki@posixlycorrect.com';
$wgEmergencyContact = 'mediawiki@posixlycorrect.com';
$wgPasswordSender = 'mediawiki@posixlycorrect.com';
'';
extensions = {
# some extensions are included and can enabled by passing null
VisualEditor = null;
CategoryTree = null;
CiteThisPage = null;
Scribunto = null;
Cite = null;
CodeEditor = null;
Math = null;
MultimediaViewer = null;
PdfHandler = null;
Poem = null;
SecureLinkFixer = null;
WikiEditor = null;
ParserFunctions = null;
};
};
};
services.openssh = {

View file

@ -8,7 +8,6 @@
with lib; {
imports = [
./net.nix
./mediawiki.nix
./forgejo.nix
./vaultwarden.nix
./msmtp.nix

View file

@ -1,71 +0,0 @@
{
lib,
pkgs,
flakes,
...
}:
with lib; {
services = {
nginx = {
virtualHosts."wiki.posixlycorrect.com" = {
enableACME = true;
forceSSL = true;
extraConfig = ''
proxy_headers_hash_max_size 512;
proxy_headers_hash_bucket_size 128;
'';
};
};
mediawiki = {
enable = true;
name = "posixlycorrect wiki";
webserver = "nginx";
nginx.hostName = "wiki.posixlycorrect.com";
database.type = "postgres";
passwordFile = "/run/keys/mediawiki-password";
skins = {
citizen = "${flakes.mediawikiSkinCitizen}";
};
extraConfig = ''
# Disable anonymous editing and account creation
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['createaccount'] = false;
$wgDefaultSkin = 'citizen';
$wgDefaultMobileSkin = 'citizen';
$wgCitizenThemeDefault = 'dark';
$wgCitizenShowPageTools = 'login';
$wgLogos = [
'icon' => "https://posixlycorrect.com/favicon.png",
'1x' => "https://posixlycorrect.com/favicon.png",
'2x' => "https://posixlycorrect.com/favicon.png",
];
$wgEnableEmail = false; #TODO: arreglar esto
$wgNoReplyAddress = 'mediawiki@posixlycorrect.com';
$wgEmergencyContact = 'mediawiki@posixlycorrect.com';
$wgPasswordSender = 'mediawiki@posixlycorrect.com';
'';
extensions = {
# some extensions are included and can enabled by passing null
VisualEditor = null;
CategoryTree = null;
CiteThisPage = null;
Scribunto = null;
Cite = null;
CodeEditor = null;
Math = null;
MultimediaViewer = null;
PdfHandler = null;
Poem = null;
SecureLinkFixer = null;
WikiEditor = null;
ParserFunctions = null;
};
};
};
}

View file

@ -0,0 +1,13 @@
{
config,
lib,
pkgs,
doctrine,
...
}:
doctrine.lib.mkModule {
inherit config;
name = "mediawiki";
sys = ./sys.nix;
options = ./options.nix;
}

View file

@ -0,0 +1,72 @@
{lib, ...}:
with lib.types; {
sys = {
hostName = lib.mkOption {
type = str;
description = "used for nginx virtualhost. no protocol";
example = "wiki.posixlycorrect.com";
};
name = lib.mkOption {
type = str;
description = "name of the wiki";
example = "posixlycorrect wiki";
};
passwordFile = lib.mkOption {
type = types.path;
description = "path of passwordfile for mediawiki";
example = "/run/keys/mediawiki-password";
};
skins = lib.mkOption {
type = types.attrsOf (types.nullOr str);
description = "skins for mediawiki";
example = ''{
citizen = "flakes.mediawikiSkinCitizen";
};'';
};
extraConfig = lib.mkOption {
type = str;
example = ''
# Disable anonymous editing and account creation
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['createaccount'] = false;
$wgCitizenThemeDefault = 'dark';
$wgCitizenShowPageTools = 'login';
$wgLogos = [
'icon' => "https://example.com/favicon.png",
'1x' => "https://example.com/favicon.png",
'2x' => "https://example.com/favicon.png",
];
$wgEnableEmail = false; #TODO: arreglar esto
$wgNoReplyAddress = 'mediawiki@example.com';
$wgEmergencyContact = 'mediawiki@example.com';
$wgPasswordSender = 'mediawiki@example.com';
'';
};
extensions = lib.mkOption {
type = types.attrsOf (types.nullOr types.path);
description = "some extensions are included and can enabled by passing null";
example = ''{
VisualEditor = null;
CategoryTree = null;
CiteThisPage = null;
Scribunto = null;
Cite = null;
CodeEditor = null;
Math = null;
MultimediaViewer = null;
PdfHandler = null;
Poem = null;
SecureLinkFixer = null;
WikiEditor = null;
ParserFunctions = null;
};'';
};
};
}

View file

@ -0,0 +1,31 @@
{
pkgs,
lib,
cfg,
doctrine,
...
}: with lib; {
services = {
nginx = {
virtualHosts.${cfg.hostName} = {
enableACME = true;
forceSSL = true;
extraConfig = ''
proxy_headers_hash_max_size 512;
proxy_headers_hash_bucket_size 128;
'';
};
};
mediawiki = {
enable = true;
name = cfg.name;
webserver = "nginx";
nginx.hostName = cfg.hostName;
database.type = "postgres";
passwordFile = cfg.passwordFile;
skins = cfg.skins;
extraConfig = cfg.extraConfig;
extensions = cfg.extensions;
};
};
}