aboutsummaryrefslogtreecommitdiff
path: root/virtual/packages/ympd.nix
blob: 74bf2e5d202c65449a6af4e152207405eafdcd9b (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
{}:
let
  ympd = rec {
    config = {
      webPort = "localhost:18001";
      mpd = {
        host = "malige.home.immae.eu";
        port = 6600;
      };
    };
    apache = {
      modules = [
        "proxy_wstunnel"
        ];
      vhostConf = ''
        <LocationMatch "^/mpd">
          Use LDAPConnect
          Require ldap-group   cn=users,cn=mpd,ou=services,dc=immae,dc=eu
          Require local
        </LocationMatch>

        RedirectMatch permanent "^/mpd$" "/mpd/"
        <Location "/mpd/">
          ProxyPass http://${config.webPort}/
          ProxyPassReverse http://${config.webPort}/
          ProxyPreserveHost on
        </Location>
        <Location "/mpd/ws">
          ProxyPass ws://${config.webPort}/ws
        </Location>
      '';
    };
  };
in
  ympd