blob: aa24e01d17a44b7744ee52b2b484defc4214d9ab (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# MediaWiki server for Wikipedia research
# Copyright (C) 2023 Nguyễn Gia Phong
#
# This file is part of loang configuration.
#
# Loang configuration is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Loang configuration is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with loang configuration. If not, see <https://www.gnu.org/licenses/>.
{ config, lib, ... }:
let hostname = "nhanh.${config.networking.domain}";
in {
services = {
mediawiki = {
database.type = "postgres";
enable = true;
extensions = {
# null means enabled here.
Cite = null;
Interwiki = null;
};
extraConfig = ''
$wgEnableEmail = false;
$wgGroupPermissions['*']['read'] = false;
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['createaccount'] = false;
'';
name = "Research on Wikipedia governance";
nginx.hostName = hostname;
passwordFile = "/dev/null"; # this is so dumb
webserver = "nginx";
};
nginx.virtualHosts.${hostname} = {
enableACME = true;
forceSSL = true;
# Work around resources not found:
# https://github.com/NixOS/nixpkgs/pull/255776#issuecomment-1759131411
locations = let
inherit (lib) mkForce;
rewrite = {
extraConfig = mkForce ''
rewrite ^/w/(.*) /$1 break;
add_header Cache-Control "public";
expires 7d;
'';
tryFiles = mkForce null;
};
in {
"~ ^/w/resources/(assets|lib|src)" = rewrite;
"~ ^/w/(skins|extensions)/.+\\.(css|js|gif|jpg|jpeg|png|svg|wasm|ttf|woff|woff2)$" = rewrite;
};
};
};
}
|