mpd: fix socket activation

Apparently since systemd v250 a `ListenStream` in an override file won't
override the unit, but will be appended to a list of socket addresses.
The socket unit fails if two or more addresses have the same port,
probably because two systemd processes try to listen to it at once.
The solution is to add an empty `ListenStream=` to reset all previous
definitions.

Fix #175478.
This commit is contained in:
rnhmjoj 2022-06-11 20:46:48 +02:00
parent 6bd5219cc1
commit 7149c5cb60
No known key found for this signature in database
GPG key ID: BFBAF4C975F76450

View file

@ -215,6 +215,7 @@ in {
systemd.sockets.mpd = mkIf cfg.startWhenNeeded {
wantedBy = [ "sockets.target" ];
listenStreams = [
"" # Note: this is needed to override the upstream unit
(if pkgs.lib.hasPrefix "/" cfg.network.listenAddress
then cfg.network.listenAddress
else "${optionalString (cfg.network.listenAddress != "any") "${cfg.network.listenAddress}:"}${toString cfg.network.port}")