[Nix-dev] Permission error when installing mpd

James Cook james.cook at utoronto.ca
Thu Feb 19 07:49:22 CET 2015


On 18 February 2015 at 22:22, Nikita Karetnikov <nikita at karetnikov.org> wrote:
> I've tried various options, but mpd always fails with a permission error.
> Here's one example:
>
>   services.mpd.enable = true;
>   services.mpd.dataDir = "/home/nikita/dotfiles/mpd/.mpd";
>   services.mpd.musicDirectory = "/home/nikita/music";
>
> Both directories exist.
>
> $ journalctl -u mpd.service
>
> Feb 19 09:11:22 mu systemd[1]: Starting Music Player Daemon...
> Feb 19 09:11:22 mu systemd[1]: mpd.service: control process exited, code=exited status=1
> Feb 19 09:11:22 mu systemd[1]: Failed to start Music Player Daemon.
> Feb 19 09:11:22 mu systemd[1]: Unit mpd.service entered failed state.
> Feb 19 09:11:22 mu systemd[1]: mpd.service failed.
> Feb 19 09:11:22 mu mpd-pre-start[15264]: mkdir: cannot create directory ‘/home/nikita’: Permission denied
>
> Why is it even trying to create "/home/nikita"?

Hi Nikita,

Looking at the source (nixos/modules/services/audio/mpd.nix), it looks
like the mpd service is designed to run as the mpd user. If you are
willing to go with that design, I guess you should not set
services.mpd.dataDir, and make sure the mpd user has read access to
your music directory. (It tries to create /home/nikita because that's
where its dataDir is supposed to go.)

If you'd rather mpd be run as your own user, I don't think NixOS has
support for that, so the easiest solution is probably to add mpd to
environment.systemPackages and just start mpd yourself.

James


More information about the nix-dev mailing list