fix(nixos): route UxPlay audio directly to ALSA on sunken-ship 🔊

Drop PipeWire (WirePlumber fails to detect ALSA cards without a
graphical session). Use GStreamer alsasink with plughw:USB,0 to
output directly to the Scarlett Solo.
This commit is contained in:
DannyDannyDanny 2026-03-30 16:16:18 +02:00
parent 84715596f5
commit cea6913cf3

View file

@ -65,16 +65,6 @@ in
alsa-utils # aplay, amixer, arecord for audio debugging alsa-utils # aplay, amixer, arecord for audio debugging
]; ];
# PipeWire — sound server for UxPlay / GStreamer.
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true; # PulseAudio compat for GStreamer pulsesink
};
# PipeWire runs as a user service; ensure it starts for danny even without a login session.
systemd.user.services.pipewire.wantedBy = [ "default.target" ];
systemd.user.services.pipewire-pulse.wantedBy = [ "default.target" ];
# Avahi (mDNS) — required for AirPlay discovery. # Avahi (mDNS) — required for AirPlay discovery.
services.avahi = { services.avahi = {
enable = true; enable = true;
@ -88,21 +78,21 @@ in
allowedUDPPorts = [ 5353 6000 6001 7011 ]; allowedUDPPorts = [ 5353 6000 6001 7011 ];
}; };
# UxPlay AirPlay receiver — audio-only, runs as a user service under danny. # UxPlay AirPlay receiver — audio-only, outputs directly to Scarlett Solo via ALSA.
# Runs inside danny's user session so it can reach PipeWire/PulseAudio. # Runs as a system service (no PipeWire needed on a headless server).
systemd.user.services.uxplay = { systemd.services.uxplay = {
description = "UxPlay AirPlay receiver"; description = "UxPlay AirPlay receiver";
after = [ "pipewire-pulse.service" ]; after = [ "network-online.target" "avahi-daemon.service" ];
wants = [ "pipewire-pulse.service" ]; wants = [ "network-online.target" "avahi-daemon.service" ];
wantedBy = [ "default.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.uxplay}/bin/uxplay -n sunken-ship -p -vs 0"; ExecStart = "${pkgs.uxplay}/bin/uxplay -n sunken-ship -p -vs 0 -as alsasink device=plughw:USB,0";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 5; RestartSec = 5;
User = "danny";
SupplementaryGroups = [ "audio" ];
}; };
}; };
# Ensure danny's user services start at boot (not just on login).
users.users.danny.linger = true;
# Pull dotfiles and rebuild if the repo has new commits. # Pull dotfiles and rebuild if the repo has new commits.
systemd.services.dotfiles-rebuild = { systemd.services.dotfiles-rebuild = {