2025-07-06 01:35:03 +02:00
{
username ,
config ,
pkgs ,
. . .
} :
2025-07-01 16:29:21 +02:00
{
services . mpd = {
enable = true ;
2025-07-07 23:20:43 +02:00
musicDirectory = " / h o m e / l i v / M u s i c " ;
2025-07-01 16:29:21 +02:00
extraConfig = ''
audio_output {
type " p i p e w i r e "
name " p i p e w i r e "
}
'' ;
user = " ${ username } " ; # PipeWire requires this as it runs as the normal user and mpd normally runs as a system user.
# Optional:
# network.listenAddress = "any"; # if you want to allow non-localhost connections
} ;
systemd . services . mpd . environment = {
# see: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/609
2025-07-07 23:20:43 +02:00
XDG_RUNTIME_DIR = " / r u n / u s e r / ${ toString config . users . users . ${ username } . uid } " ; # User-id must match above user. MPD will look inside this directory for the PipeWire socket.
2025-07-01 16:29:21 +02:00
} ;
2025-07-06 01:35:03 +02:00
2025-07-07 23:20:43 +02:00
environment . systemPackages = with pkgs ; [
2025-07-06 01:35:03 +02:00
mpdris2
2025-07-07 23:20:43 +02:00
ncmpcpp
2025-07-06 01:35:03 +02:00
] ;
2025-07-01 16:29:21 +02:00
}