]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - nixops/modules/websites/tools/tools/ympd.nix
Use sockets instead of ports in mpd
[perso/Immae/Config/Nix.git] / nixops / modules / websites / tools / tools / ympd.nix
index 3d0faad5153782451913fe7421dc9a94465431e3..b54c48665d893638cd160cd330078ea973d324f5 100644 (file)
@@ -3,14 +3,15 @@ let
   ympd = rec {
     config = {
       webPort = "localhost:${env.listenPort}";
-      mpd = env.mpd;
+      host = env.mpd.host;
+      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 +25,14 @@ let
         <Location "/mpd/ws">
           ProxyPass ws://${config.webPort}/ws
         </Location>
+        <Location "/mpd/music.mp3">
+          ProxyPass unix:///run/mpd/mp3.sock|http://tools.immae.eu/
+          ProxyPassReverse unix:///run/mpd/mp3.sock|http://tools.immae.eu/
+        </Location>
+        <Location "/mpd/music.ogg">
+          ProxyPass unix:///run/mpd/ogg.sock|http://tools.immae.eu/
+          ProxyPassReverse unix:///run/mpd/ogg.sock|http://tools.immae.eu/
+        </Location>
       '';
     };
   };