Hello! I’m having trouble setting up a Mopidy server on my Raspberry Pi 3.
I’m following the suggestion of this comment to have a global pipewire installation and grant the Mopidy service user access to it. I’ve also incorporated the pipewire / pulseaudio config from mopidy’s docs.
mopidy.nix:
{ pkgs, ... }:
let
musicGroups = [
"pipewire"
"audio"
"mopidy"
];
in
{
imports = [
../audio/pipewire.nix
];
services.mopidy = {
enable = true;
extensionPackages = with pkgs; [
mopidy-jellyfin
mopidy-iris
];
settings = {
http = {
enabled = true;
port = 6680;
};
audio.output = "pulsesink server=127.0.0.1";
jellyfin = {
# Hidden
};
logging.verbosity = 4;
};
};
networking.firewall = {
enable = true;
allowedTCPPorts = [
6680
];
};
systemd.services = {
mpd.serviceConfig.SupplementaryGroups = musicGroups;
mopidy.serviceConfig.SupplementaryGroups = musicGroups;
pipewire-pulse.serviceConfig.SupplementaryGroups = musicGroups;
};
users.users.mopidy.extraGroups = musicGroups;
users.users.root.extraGroups = musicGroups;
}
pipewire.nix:
{ pkgs, ... }:
{
# Enable sound with pipewire.
security.rtkit.enable = true;
services = {
pipewire = {
enable = true;
systemWide = true;
pulse.enable = true;
wireplumber.enable = true;
alsa.enable = false;
alsa.support32Bit = false;
};
pulseaudio.enable = false;
};
services.pipewire.extraConfig.pipewire-pulse."92-low-latency" = {
"context.properties" = [
{
name = "libpipewire-module-protocol-pulse";
args = { };
}
];
"pulse.properties" = {
"pulse.min.req" = "32/48000";
"pulse.default.req" = "32/48000";
"pulse.max.req" = "32/48000";
"pulse.min.quantum" = "32/48000";
"pulse.max.quantum" = "32/48000";
"unix" = "native";
"tcp" = "4713";
};
"stream.properties" = {
"node.latency" = "32/48000";
"resample.quality" = 1;
};
};
environment.systemPackages = with pkgs; [
wiremix
pulseaudio
];
}
Raspi configuration.nix
{ pkgs, ... }:
{
imports = [
# This module installs the firmware
"${modulesPath}/installer/sd-card/sd-image-aarch64.nix"
];
# Root File System
fileSystems."/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
# Required system packages
environment.systemPackages = with pkgs; [
libraspberrypi
raspberrypi-eeprom
];
# Prevent host becoming unreachable on wifi after some time.
networking.networkmanager.wifi.powersave = false;
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
boot.loader = {
grub.enable = false;
generic-extlinux-compatible.enable = true;
};
hardware.enableRedistributableFirmware = true;
nixpkgs.hostPlatform = "aarch64-linux";
networking.hostName = "turndesk";
services.mopidy.settings.http.hostname = "turndesk.home";
hardware = {
deviceTree = {
enable = true;
filter = "*rpi-3-*.dtb";
};
};
# Audio
boot.kernelParams = [
"snd_bcm2835.enable_hdmi=0"
"snd_bcm2835.enable_headphones=1"
];
# Make sure to add to Config.txt:
# dtparam=audio=on
# hdmi_ignore_edid_audio=1
# https://wiki.nixos.org/wiki/NixOS_on_ARM/Raspberry_Pi_4#Audio
system.stateVersion = "25.05";
}
I’m having a similar issue to this unsolved post where I’m able to view the music in my library but pressing play doesn’t work. In the logs I can see a GStreamer error:
Feb 24 16:00:10 turndesk mopidy[3541]: DEBUG 2026-02-24 16:00:10,184 [3541:SoftwareMixer-1 (_actor_loop)] mopidy.mixer
Feb 24 16:00:10 turndesk mopidy[3541]: Mixer event: volume_changed(volume=100)
Feb 24 16:00:10 turndesk mopidy[3541]: DEBUG 2026-02-24 16:00:10,185 [3541:SoftwareMixer-1 (_actor_loop)] mopidy.listener
Feb 24 16:00:10 turndesk mopidy[3541]: Sending volume_changed to MixerListener: {'volume': 100}
Feb 24 16:00:10 turndesk mopidy[3541]: ERROR 2026-02-24 16:00:10,197 [3541:MainThread] mopidy.audio.gst
Feb 24 16:00:10 turndesk mopidy[3541]: GStreamer error: Failed to connect: Connection refused
Feb 24 16:00:10 turndesk mopidy[3541]: DEBUG 2026-02-24 16:00:10,198 [3541:Audio-2 (_actor_loop)] mopidy.audio.gst
Feb 24 16:00:10 turndesk mopidy[3541]: Changing state to GST_STATE_PLAYING: result=GST_STATE_CHANGE_FAILURE
Feb 24 16:00:10 turndesk mopidy[3541]: WARNING 2026-02-24 16:00:10,199 [3541:Audio-2 (_actor_loop)] mopidy.audio.actor
Feb 24 16:00:10 turndesk mopidy[3541]: Setting GStreamer state to GST_STATE_PLAYING failed
Feb 24 16:00:10 turndesk mopidy[3541]: DEBUG 2026-02-24 16:00:10,198 [3541:MainThread] mopidy.audio.gst
Feb 24 16:00:10 turndesk mopidy[3541]: Got ERROR bus message: error=GLib.Error('Failed to connect: Connection refused', 'gst-resource-error-quark', 1) debug='../ext/pulse/pulsesink.c(616): gst_pulseringbuffer_open_device (): /GstBin:audio-sink/mopidy+audio+actor+_Outputs:mopidy+audio+actor+_outputs0/GstBin:bin0/GstPulseSink:pulsesink0'
Feb 24 16:00:10 turndesk mopidy[3541]: DEBUG 2026-02-24 16:00:10,201 [3541:MainThread] mopidy.audio.gst
Feb 24 16:00:10 turndesk mopidy[3541]: Changing state to GST_STATE_NULL: result=GST_STATE_CHANGE_SUCCESS
Which is probably in turn caused by the pipewire-pulse error on startup:
Feb 24 16:02:33 turndesk systemd[1]: Started PipeWire PulseAudio Service.
Feb 24 16:02:33 turndesk pipewire-pulse[5047]: mod.protocol-pulse: failed to open pid file: Permission denied
Feb 24 16:02:33 turndesk pipewire-pulse[5047]: mod.protocol-pulse: 0x559d540690: can't create pid file: Permission denied
Feb 24 16:02:33 turndesk pipewire-pulse[5047]: spa.dbus: Failed to connect to session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Or the pipewire error on service startup:
Feb 24 16:01:01 turndesk systemd[1]: Started PipeWire Multimedia Service.
Feb 24 16:01:02 turndesk pipewire[3915]: spa.dbus: Failed to connect to session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Feb 24 16:01:02 turndesk pipewire[3915]: mod.portal: Failed to connect to session bus: Input/output error
Feb 24 16:01:02 turndesk pipewire[3915]: spa.dbus: Failed to connect to session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Feb 24 16:01:02 turndesk pipewire[3915]: mod.jackdbus-detect: Failed to connect to session bus: Input/output error
In the above message it’s complaining about having no display, which is correct as it’s a headless setup. I can rule out hardware issues as I am able to play files using pw-play and paplay using the root account.
I have no idea what is causing the service errors, which I think are causing Mopidy to be unable to play anything. Can anyone help?