]> git.immae.eu Git - perso/Immae/Config/Nix.git/commitdiff
Use sockets instead of ports in mpd
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 22 Apr 2019 17:03:18 +0000 (19:03 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 22 Apr 2019 17:03:18 +0000 (19:03 +0200)
nixops/modules/mpd/default.nix
nixops/modules/websites/tools/tools/ympd.nix

index 9e1715baeb17a29acc441b2fdd6e16fe3491ff26..2cf37adfe6b9be5fd8e840495daaf32c0d6ab4bd 100644 (file)
@@ -20,6 +20,9 @@
     };
     networking.firewall.allowedTCPPorts = [ 6600 ];
     users.users.mpd.extraGroups = [ "wwwrun" "keys" ];
+    system.activationScripts.mpd = ''
+      install -d -m 0755 -o mpd -g mpd /run/mpd
+      '';
     services.mpd = {
       enable = true;
       network.listenAddress = "any";
@@ -35,8 +38,7 @@
           type            "httpd"
           name            "OGG"
           encoder         "vorbis"
-          port            "${myconfig.env.ports.mpd_ogg}"
-          bind_to_address "127.0.0.1"
+          bind_to_address "/run/mpd/ogg.sock"
           quality         "5.0"
           format          "44100:16:1"
         }
@@ -44,8 +46,7 @@
           type            "httpd"
           name            "MP3"
           encoder         "lame"
-          port            "${myconfig.env.ports.mpd_mp3}"
-          bind_to_address "127.0.0.1"
+          bind_to_address "/run/mpd/mp3.sock"
           quality         "5.0"
           format          "44100:16:1"
         }
index 82d9321d1d77b53454ed17181f9a5eb668d80680..b54c48665d893638cd160cd330078ea973d324f5 100644 (file)
@@ -26,12 +26,12 @@ let
           ProxyPass ws://${config.webPort}/ws
         </Location>
         <Location "/mpd/music.mp3">
-          ProxyPass http://localhost:${env.mp3port}/
-          ProxyPassReverse http://localhost:${env.mp3port}/
+          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 http://localhost:${env.oggport}/
-          ProxyPassReverse http://localhost:${env.oggport}/
+          ProxyPass unix:///run/mpd/ogg.sock|http://tools.immae.eu/
+          ProxyPassReverse unix:///run/mpd/ogg.sock|http://tools.immae.eu/
         </Location>
       '';
     };