{ pkgs, ... }: { # MPD server (music player daemon). The audio_output points at PipeWire # through its PulseAudio compatibility layer, since desktop audio is handled # by modules/system/audio. services.mpd = { enable = true; user = "seraphim"; openFirewall = false; settings = { music_directory = "/mnt/giga/music"; bind_to_address = "any"; port = 6600; auto_update = "yes"; audio_output = [ { type = "pulse"; name = "PipeWire Output"; mixer_type = "hardware"; } ]; }; }; # MPD runs as a system service, so it needs the per-user runtime dir to # reach the PipeWire socket. systemd.services.mpd.environment = { XDG_RUNTIME_DIR = "/run/user/1000"; }; # mpd-mpris bridges MPD to the MPRIS media control interface (used by # Waybar/media keys). Lives here because it only matters when MPD is on. systemd.user.services.mpd-mpris = { description = "MPD MPRIS Service for Waybar"; wantedBy = [ "default.target" ]; after = [ "graphical-session.target" ]; serviceConfig = { ExecStart = "${pkgs.mpd-mpris}/bin/mpd-mpris -network tcp -host 127.0.0.1 -port 6600"; Restart = "on-failure"; }; }; }