From 9df76627240b567f8cbb00d1b429aa3541243558 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Mon, 22 Apr 2019 19:03:18 +0200 Subject: [PATCH] Use sockets instead of ports in mpd --- nixops/modules/mpd/default.nix | 9 +++++---- nixops/modules/websites/tools/tools/ympd.nix | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/nixops/modules/mpd/default.nix b/nixops/modules/mpd/default.nix index 9e1715b..2cf37ad 100644 --- a/nixops/modules/mpd/default.nix +++ b/nixops/modules/mpd/default.nix @@ -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" } diff --git a/nixops/modules/websites/tools/tools/ympd.nix b/nixops/modules/websites/tools/tools/ympd.nix index 82d9321..b54c486 100644 --- a/nixops/modules/websites/tools/tools/ympd.nix +++ b/nixops/modules/websites/tools/tools/ympd.nix @@ -26,12 +26,12 @@ let ProxyPass ws://${config.webPort}/ws - 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/ - 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/ ''; }; -- 2.41.0