summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/deployment/nixos.wiki/mediawiki.nix
blob: a346b82cb52b6f114bbfca2f0f64e64f0f29704b (plain)
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
65
66
67
{ config, pkgs, ... }:

let
  hostAddress = "192.168.48.1";
  localAddress = "192.168.48.3";
in

{
  containers.mediawiki =
  { autoStart = true;
    privateNetwork = true;
    inherit hostAddress localAddress;
    config = { config, pkgs, ... }:
    {
      # NOTE: This disabling and importing is so that the basePath can be altered
      disabledModules = [ "services/web-apps/mediawiki.nix" ];
      imports = [
        ./mediawiki.module.nix
      ];
      time.timeZone = "America/New_York";
      system.stateVersion = "20.09";
      networking.defaultGateway = hostAddress;
      # NOTE: you might want to change this namserver address
      networking.nameservers = [ "8.8.8.8" ];
      networking.firewall.allowedTCPPorts = [ 80 ];
      services.mediawiki = {
        enable = true;
        name = "Example Containerized Wiki";
        # NOTE: here is where the basePath is specified, which requires the imported mediawiki NixOS module
        basePath = "/wiki";
        passwordFile = ./mediawiki.password.txt;
        extraConfig = ''
          $wgRCFeeds['euerkrebsco'] = array(
              'formatter' => 'JSONRCFeedFormatter',
              'uri' => 'udp://euer.krebsco.de:5005',
              'add_interwiki_prefix' => false,
              'omit_bots' => true,
          );
          $wgRCFeeds['euerkrebscoIRC'] = array(
              'formatter' => 'IRCColourfulRCFeedFormatter',
              'uri' => 'udp://euer.krebsco.de:5006',
              'add_interwiki_prefix' => false,
              'omit_bots' => true,
          );
        '';
        virtualHost = {
          hostName = "localhost";
          adminAddr = "root@localhost";
          forceSSL = false;
          addSSL = false;
          onlySSL = false;
          enableACME = false;
        };
      };
    };
  };

  # Put the MediaWiki web page behind an NGINX proxy
  services.nginx = {
    enable = true;
    virtualHosts.localhost.locations."/wiki" = {
      # NOTE: the slash at the end of the URI is important.  It causes the location base path to be removed when passed onto the proxy
      proxyPass = "http://${localAddress}:80/";
    };
  };

}