aboutsummaryrefslogblamecommitdiff
path: root/modules/private/websites/tools/im/default.nix
blob: 94dc4f81d242143e8e3561897d67ba21757dc951 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
                           















                                                    
                                                  














                                                               



                                          




            
{ config, lib, pkgs, ... }:
let
  cfg = config.myServices.websites.tools.im;
in
{
  options.myServices.websites.tools.im = {
    enable = lib.mkEnableOption "enable im website";
  };

  config = lib.mkIf cfg.enable {
    services.websites.env.tools.vhostConfs.im = {
      certName   = "eldiron";
      addToCerts = true;
      hosts      = ["im.immae.fr"];
      root       = ./www;
      extraConfig = [
        ''
          Alias /glowing-bear ${pkgs.glowing-bear}
          Alias /converse ${./www}/converse.html
          ProxyPreserveHost On
          <Location "/bosh">
            ProxyPass http://localhost:5280/bosh
            ProxyPassReverse http://localhost:5280/bosh
          </Location>
          <Location "/ws">
            ProxyPass ws://localhost:5280/ws
          </Location>
          ProxyPass /upload http://localhost:5280/upload
          ProxyPassReverse /upload http://localhost:5280/upload
          ProxyPass /admin http://localhost:5280/admin
          ProxyPassReverse /admin http://localhost:5280/admin
          ProxyPass /api http://localhost:5280/api
          ProxyPassReverse /api http://localhost:5280/api
          <Directory ${pkgs.glowing-bear}>
          AllowOverride none
          Require all granted
          </Directory>
          ''
      ];
    };
  };
}