From 6aec046f12e1e0c2c30a2f219fe94d506001542c Mon Sep 17 00:00:00 2001 From: root Date: Wed, 7 Sep 2022 12:42:14 +0200 Subject: [PATCH] mediawiki runs --- flake.lock | 10 +++--- flake.nix | 3 +- modules/wiki.nix | 83 ++++++++++++++++++++++++++++++++++++------------ 3 files changed, 70 insertions(+), 26 deletions(-) diff --git a/flake.lock b/flake.lock index d9194a0..ce513b7 100644 --- a/flake.lock +++ b/flake.lock @@ -87,15 +87,15 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1660215038, - "narHash": "sha256-tqMyd5QB4MZh59wMHXqpro4hkKjz9ubQxkxFSuCuBGE=", - "owner": "NixOS", + "lastModified": 1662496411, + "narHash": "sha256-BLzFzRQewnmzdCrcOv2f+IYQI9iY25MXBmJWHoxWynY=", + "owner": "revol-xut", "repo": "nixpkgs", - "rev": "45c9736ed69800a6ff2164fb4538c9e40dad25d6", + "rev": "6d2d09e50ba9d12b80ed1c3be844f1d120e02682", "type": "github" }, "original": { - "owner": "NixOS", + "owner": "revol-xut", "ref": "nixos-22.05", "repo": "nixpkgs", "type": "github" diff --git a/flake.nix b/flake.nix index 198fa04..4ee246c 100755 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,7 @@ { inputs = { - nixpkgs.url = github:NixOS/nixpkgs/nixos-22.05; + nixpkgs.url = github:revol-xut/nixpkgs/nixos-22.05; + #nixpkgs.url = github:revol-xut/nixpkgs/master; sops-nix.url = github:Mic92/sops-nix; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; fsr-infoscreen.url = github:fsr/infoscreen; diff --git a/modules/wiki.nix b/modules/wiki.nix index 9d1e4c1..0caf09d 100644 --- a/modules/wiki.nix +++ b/modules/wiki.nix @@ -5,7 +5,15 @@ "mediawiki/initial_admin".owner = config.users.users.mediawiki.name; "mediawiki/ldapprovider".owner = config.users.users.mediawiki.name; }; - + +# users.users.mediawiki.extraGroups = [ "postgres" ]; + nixpkgs.overlays = [ + (final: prev: { + final.config.systemd.services.mediawiki-init.script = '' + + ''; + }) + ]; services = { mediawiki = { enable = true; @@ -13,24 +21,45 @@ passwordFile = config.sops.secrets."mediawiki/initial_admin".path; database = { type = "postgres"; - socket = "/var/run/postgresql"; +# socket = "/run/postgresql"; user = "mediawiki"; name = "mediawiki"; + host = "localhost"; + port = 5432; + passwordFile = config.sops.secrets."mediawiki/postgres".path; }; - virtualHost = { - hostName = "wiki.quitte.tassilo-tanneberger.de"; - adminAddr = "root@ifsr.de"; - forceSSL = true; - enableACME = true; - }; +# virtualHost = { +# hostName = "wiki.quitte.tassilo-tanneberger.de"; +# adminAddr = "root@ifsr.de"; +# forceSSL = true; +# enableACME = true; +# }; + + virtualHost = { + hostName = "wiki.quitte.tassilo-tanneberger.de"; + adminAddr = "root@ifsr.de"; + #forceSSL = true; + #enableACME = true; + }; + + virtualHost.listen = [ + { + ip = "127.0.0.1"; + port = 8080; + ssl = false; + } + ]; extraConfig = '' - $wgArticlePath = '/$1'; + $wgDBport = "5432"; + $wgDBmwschema = "mediawiki"; - $wgShowExceptionDetails = true; - $wgDBserver = "${config.services.mediawiki.database.socket}"; - $wgDBmwschema = "mediawiki"; + $wgDBserver = "localhost"; + $wgDBname = "mediawiki"; + + + /////// $wgArticlePath = '/$1'; // $wgLogo = "https://www.c3d2.de/images/ck.png"; $wgEmergencyContact = "root@ifsr.de"; @@ -87,10 +116,10 @@ $wgPluggableAuth_EnableLocalLogin = true; ''; extensions = { - Cite = pkgs.fetchzip { - url = "https://web.archive.org/web/20220627203658/https://extdist.wmflabs.org/dist/extensions/Cite-REL1_38-d40993e.tar.gz"; - sha256 = "sha256-dziMo6sH4yMPjnDtt0TXiGBxE5uGRJM+scwdeuer5sM="; - }; + #Cite = pkgs.fetchzip { + # url = "https://web.archive.org/web/20220627203658/https://extdist.wmflabs.org/dist/extensions/Cite-REL1_38-d40993e.tar.gz"; + # sha256 = "sha256-dziMo6sH4yMPjnDtt0TXiGBxE5uGRJM+scwdeuer5sM="; + #}; 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="; @@ -132,10 +161,10 @@ url = "https://web.archive.org/web/20220807185047/https://extdist.wmflabs.org/dist/extensions/PluggableAuth-REL1_38-126bad8.tar.gz"; sha256 = "sha256-cdJdhj7+qisVVePuyKDu6idoUy0+gYo3zMN0y6weH84="; }; - 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="; - }; + #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="; + #}; 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="; @@ -156,6 +185,20 @@ "mediawiki" ]; }; + nginx = { + recommendedProxySettings = true; + virtualHosts = { + "wiki.quitte.tassilo-tanneberger.de" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:8080"; + proxyWebsockets = true; + }; + }; + }; + }; + }; systemd.services.mediawiki-pgsetup = { description = "Prepare Mediawiki postgres database";