]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/websites/tools/tools/ympd.nix
Add mpd and make adjustments
[perso/Immae/Config/Nix.git] / nixops / modules / websites / tools / tools / ympd.nix
CommitLineData
bfe3c9c9 1{ env }:
940f1834
IB
2let
3 ympd = rec {
4 config = {
bfe3c9c9 5 webPort = "localhost:${env.listenPort}";
e229e6f2
IB
6 mpd = {
7 host = "${env.mpd.host} --mpdpass ${env.mpd.password}";
8 port = env.mpd.port;
9 };
940f1834
IB
10 };
11 apache = {
12 modules = [
13 "proxy_wstunnel"
14 ];
15 vhostConf = ''
e229e6f2 16 <LocationMatch "^/mpd(?!/music.(mp3|ogg))">
940f1834
IB
17 Use LDAPConnect
18 Require ldap-group cn=users,cn=mpd,ou=services,dc=immae,dc=eu
940f1834
IB
19 </LocationMatch>
20
21 RedirectMatch permanent "^/mpd$" "/mpd/"
22 <Location "/mpd/">
23 ProxyPass http://${config.webPort}/
24 ProxyPassReverse http://${config.webPort}/
25 ProxyPreserveHost on
26 </Location>
27 <Location "/mpd/ws">
28 ProxyPass ws://${config.webPort}/ws
29 </Location>
e229e6f2
IB
30 <Location "/mpd/music.mp3">
31 ProxyPass http://localhost:${env.mp3port}/
32 ProxyPassReverse http://localhost:${env.mp3port}/
33 </Location>
34 <Location "/mpd/music.ogg">
35 ProxyPass http://localhost:${env.oggport}/
36 ProxyPassReverse http://localhost:${env.oggport}/
37 </Location>
940f1834
IB
38 '';
39 };
40 };
41in
42 ympd