]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - nixops/modules/websites/tools/tools/ympd.nix
Add mpd and make adjustments
[perso/Immae/Config/Nix.git] / nixops / modules / websites / tools / tools / ympd.nix
index 3d0faad5153782451913fe7421dc9a94465431e3..613a171c6c8275898f6a86cf479c3f888659cd8f 100644 (file)
@@ -3,14 +3,17 @@ let
   ympd = rec {
     config = {
       webPort = "localhost:${env.listenPort}";
-      mpd = env.mpd;
+      mpd = {
+        host = "${env.mpd.host} --mpdpass ${env.mpd.password}";
+        port = env.mpd.port;
+      };
     };
     apache = {
       modules = [
         "proxy_wstunnel"
         ];
       vhostConf = ''
-        <LocationMatch "^/mpd">
+        <LocationMatch "^/mpd(?!/music.(mp3|ogg))">
           Use LDAPConnect
           Require ldap-group   cn=users,cn=mpd,ou=services,dc=immae,dc=eu
         </LocationMatch>
@@ -24,6 +27,14 @@ let
         <Location "/mpd/ws">
           ProxyPass ws://${config.webPort}/ws
         </Location>
+        <Location "/mpd/music.mp3">
+          ProxyPass http://localhost:${env.mp3port}/
+          ProxyPassReverse http://localhost:${env.mp3port}/
+        </Location>
+        <Location "/mpd/music.ogg">
+          ProxyPass http://localhost:${env.oggport}/
+          ProxyPassReverse http://localhost:${env.oggport}/
+        </Location>
       '';
     };
   };