I’d like to set up a Music Player Daemon service that I can access from machines on my home network. Specifically, I’m planning on running ncmpcpp clients on a NixOS box and on a mac. I’ve gotten somewhat familiar with configuring simple systemd services, but I’m new to mpd.
I imagine ultimately I’d run the server on some dedicated hardware, maybe a raspberry pi. But as a first stab, I thought I’d try to set it up as a systemwide service on the NixOS machine itself. I added the following to my configuration.nix
services.mpd = { enable = true; startWhenNeeded = true; };
With this in place, the nixos mpd module creates an mpd user whose HOME is /var/lib/mpd, and configures the service to run as that user with music_directory set to /var/lib/mpd/music.
If I start a client and check the server logs (journalctl -u mpd), I see it complaining that /var/lib/mpd/music doesn’t exist. I suppose I could address this (and similar) errors by creating the missing directories and moving my music into that location, but it has me wondering if I’m going about it wrong.
I understand mpd can be run as a user service rather than a system service. I haven’t used systemd user services before, so I’m looking at systemd/User - ArchWiki to get familiar with the concept.
Does anyone have examples I could reference to better understand how to run a systemd user service under NixOS? Or is there a totally different tack you’d suggest?