Hello, I’m trying to setup mopidy on my raspberry Pi 3B+.
I first tried to make it boot with runeaudio: https://www.runeaudio.com/ as I was used to it and knew it worked well out of the box with the raspberry Pi 3B. But it didn’t boot so I thought it was a good occasion to give NixOS ARM a try.
So I tried to configure mopidy but quickly realise that I couldn’t produce any sound, neither with mopidy, nor with aplay.
Here is my configuration (using nixos 21.05 channel):
{ config, pkgs, lib, ... }:
let
unstable = import <nixos-unstable> {};
in
{
disabledModules = [ "services/audio/mopidy.nix" ];
imports = [
./mopidy.nix
];
# Boot
boot = {
loader = {
grub.enable = false;
raspberryPi = {
enable = true;
version = 3;
uboot.enable = true;
};
timeout = 1;
};
# Kernel configuration
kernelPackages = pkgs.linuxPackages_latest;
kernelParams = [
"cma=32M"
"console=ttyS1,115200n8"
];
kernelModules = [ "bcm2835-v4l2" "vc4" "bcm2835_dma" "i2c_bcm2835" ];
};
# Audio
sound.enable = true;
hardware.pulseaudio = {
enable = true;
package = unstable.pulseaudioFull;
};
boot.loader.raspberryPi.firmwareConfig = ''
dtparam=audio=on
hdmi_drive=2
'';
# Enable additional firmware (such as Wi-Fi drivers).
hardware.enableRedistributableFirmware = true;
# Filesystems
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
"/mnt/hamilton-share" = {
device = "//192.168.1.23/public";
fsType = "cifs";
options = let
mount_opts = "uid=1001,gid=100,vers=3";
in ["${mount_opts},credentials=/etc/nixos/smb-secrets"];
};
"/mnt/hamilton-music" = {
device = "//192.168.1.23/music";
fsType = "cifs";
options = let
mount_opts = "uid=1001,gid=100,vers=3";
in ["${mount_opts},credentials=/etc/nixos/smb-secrets"];
};
};
swapDevices = [ { device = "/swapfile"; size = 1024; } ];
# Networking (see official manual or `/config/sd-image.nix` in this repo for other options)
networking.hostName = "musicpi"; # unleash your creativity!
# Packages
environment.systemPackages = with pkgs; [
# customize as needed!
vim htop
];
# Users
# === IMPORTANT ===
# Change `yourName` here with the name you'd like for your user!
users.users.scott = {
isNormalUser = true;
# Don't forget to change the home directory too.
home = "/home/scott";
# This allows this user to use `sudo`.
extraGroups = [ "wheel" "jackaudio" ];
# SSH authorized keys for this user.
shell = pkgs.zsh;
};
# Miscellaneous
time.timeZone = "Europe/Paris"; # you probably want to change this -- otherwise, ciao!
services.openssh = {
enable = true;
forwardX11 = true;
};
# WARNING: if you remove this, then you need to assign a password to your user, otherwise
# `sudo` won't work. You can do that either by using `passwd` after the first rebuild or
# by setting an hashed password in the `users.users.yourName` block as `initialHashedPassword`.
security.sudo.wheelNeedsPassword = false;
networking.firewall = {
enable = true;
allowPing = true;
allowedTCPPorts = [ 6680 ]; # Mopidy-Iris
allowedUDPPorts = [ 6680 ];
};
services.mopidy = {
enable = true;
extensionPackages = with pkgs; [ mopidy-iris ];
configuration = ''
[mpd]
enabled = true
hostname = ::
[http]
enabled = true
hostname = ::
port = 6680
zeroconf = Mopidy HTTP server on musicpi
[iris]
enabled = true
country = fr
locale = fr_FR
[audio]
output = alsasink
[file]
enabled = true
media_dirs = /mnt/hamilton-music
'';
};
# Nix
nix.gc = {
automatic = true;
options = "--delete-older-than 30d";
};
boot.cleanTmpDir = true;
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = "21.05";
}
When launching pavucontrol, I see only “Dummy Output” in the Output Devices tab. Playing wav files with aplay, I see the sound playing in pavucontrol.