MPD on PipeWire, fail to start

I copied the instructions on mpd pretty verbatim from the wiki:

MPD :: NixOS Wiki

  services.mpd = {
  enable = true;
  musicDirectory = "/home/b0ef/mm";
  extraConfig = ''
    audio_output {
    type "pipewire"
    name "My PipeWire Output"
  '';

  network.listenAddress = "any"; 
  startWhenNeeded = true; 
};

  services.mpd.user = "b0ef";
  systemd.services.mpd.environment = {
    # https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/609
    # User-id 1000 must match above user. MPD will look inside this directory for the PipeWire socket.
    XDG_RUNTIME_DIR = "/run/user/1000";
  };

, but I get:

stopping the following units: accounts-daemon.service, mpd.service
NOT restarting the following changed units: systemd-fsck@dev-disk-by\x2duuid-60c339bd\x2d88f8\x2d4d5c\x2db68d\x2dbcafca3c7dcc.service, systemd-fsck@dev-disk-by\x2duuid-7440b882\x2daecb\x2d4e4a\x2d8ecb\x2d24d7a31dc9f9.service, systemd-fsck@dev-disk-by\x2duuid-9f75e6e1\x2d1666\x2d4bdd\x2da123\x2d5670a0cecdc7.service, systemd-fsck@dev-disk-by\x2duuid-a1a7a144\x2d45de\x2d4007\x2d9d51\x2d43d25965e8d2.service, systemd-fsck@dev-disk-by\x2duuid-b53d6116\x2db84e\x2d4cbb\x2da7d0\x2dcc1cfb3089d9.service, systemd-fsck@dev-disk-by\x2duuid-b629e8e6\x2d023e\x2d47cf\x2dacc7\x2dba93b7ac48e3.service, systemd-fsck@dev-disk-by\x2duuid-ec6ef839\x2d405a\x2d42ba\x2dab70\x2d6b488c866695.service
activating the configuration...
removing user ‘mpd’
setting up /etc...
reloading user units for b0ef...
setting up tmpfiles
reloading the following units: dbus.service
restarting the following units: polkit.service
starting the following units: accounts-daemon.service, mpd.service
Job for mpd.service failed because the control process exited with error code.
See "systemctl status mpd.service" and "journalctl -xeu mpd.service" for details.
warning: the following units failed: mpd.service

× mpd.service - Music Player Daemon
     Loaded: loaded (/etc/systemd/system/mpd.service; linked; vendor preset: enabled)
    Drop-In: /nix/store/3kjwmdsbsjssgnmsv13ggvxnxhpkvy5a-system-units/mpd.service.d
             └─overrides.conf
     Active: failed (Result: exit-code) since Tue 2022-10-11 13:53:31 CEST; 22ms ago
TriggeredBy: ○ mpd.socket
       Docs: man:mpd(1)
             man:mpd.conf(5)
    Process: 1458383 ExecStartPre=/nix/store/d859h051w7cv6sg7w0xm8fp78fn4zc07-unit-script-mpd-pre-start/bin/mpd-pre-start (code=exited, status=0/SUCCESS)
    Process: 1458392 ExecStart=/nix/store/gzxa1kdg1hlkf8sd3ml5bgphkfjd8p38-mpd-0.23.8/bin/mpd --systemd /run/mpd/mpd.conf (code=exited, status=1/FAILURE)
   Main PID: 1458392 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 110ms

Oct 11 13:53:31 quasar systemd[1]: Starting Music Player Daemon...
Oct 11 13:53:31 quasar mpd[1458392]: exception: Error in /run/mpd/mpd.conf line 21; Expected '}' before end-of-file
Oct 11 13:53:31 quasar systemd[1]: mpd.service: Main process exited, code=exited, status=1/FAILURE
Oct 11 13:53:31 quasar systemd[1]: mpd.service: Failed with result 'exit-code'.
Oct 11 13:53:31 quasar systemd[1]: Failed to start Music Player Daemon.
warning: error(s) occurred while switching to the new configuration

As your logs say, you have a pretty obvious typo there, you need a closing }:

extraConfig = ''
    audio_output {
    type "pipewire"
    name "My PipeWire Output"
    }
  '';

The wiki article you link does this correctly too:

services.mpd.extraConfig = ''
  audio_output {
    type "pipewire"
    name "My PipeWire Output"
  }
'';

wow, I think I have too many new things going on;) Thanks a bunch.

1 Like