Ahwxorg/modules/services/mpd.nix
2026-06-12 04:12:52 +02:00

37 lines
931 B
Nix

{
username,
config,
pkgs,
...
}:
{
environment.systemPackages = [
pkgs.mpc
pkgs.mpdris2
pkgs.ncmpcpp
pkgs.rmpc
];
services.mpd = {
enable = true;
playlistDirectory = "/home/${username}/Music/.playlists";
musicDirectory = "/home/${username}/Music";
extraConfig = ''
restore_paused "yes"
auto_update "yes"
audio_output {
type "pipewire"
name "pipewire"
}
'';
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
XDG_RUNTIME_DIR = "/run/user/1000"; # User-id must match above user. MPD will look inside this directory for the PipeWire socket.
};
}