Add pipewire to iron

This commit is contained in:
Jakob Lechner 2025-10-02 11:50:06 +02:00
parent 81724a93e9
commit c23cd959e3
5 changed files with 61 additions and 18 deletions

View file

@ -1,6 +0,0 @@
{
boot.kernelModules = [ "snd-aloop" ];
boot.extraModprobeConfig = ''
options snd-aloop id=ledfx,bluetooth enable=1,1 pcm_substreams=2,2
'';
}

View file

@ -1,7 +1,11 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
bluez-alsa
#bluez-alsa
bluez
bluez-tools
pipewire
wireplumber
];
hardware.bluetooth = {
@ -18,11 +22,17 @@
FastConnectable = "true";
# Allow repairing of existing devices
JustWorksRepairing = "always";
# to show battery state
Experimental = true;
};
};
};
services.blueman.enable = true;
services = {
blueman.enable = true;
ofono.enable = true;
upower.enable = true;
};
systemd.services = {
bluetooth-auto-pair = {
@ -45,6 +55,7 @@
Restart = "on-failure";
};
};
/*
bluealsa-aplay = {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
@ -63,5 +74,6 @@
Restart = "on-failure";
};
};
*/
};
}

View file

@ -1,10 +1,23 @@
{ pkgs, ... }:
{
imports = [
./alsa.nix
./bluetooth-sink.nix
./ledfx.nix
./mopidy.nix
./snapclient.nix
./snapserver.nix
];
services.pipewire = {
enable = true;
systemWide = true;
audio.enable = true;
pulse.enable = true;
alsa.enable = true;
};
environment.systemPackages = [ pkgs.pulseaudio ];
users.users.jalr.extraGroups = [ "pipewire" ];
}

View file

@ -7,6 +7,29 @@ in
8888
];
services.pipewire.extraConfig.pipewire."10-ledfx-loop" = {
"context.modules" = [
{
name = "libpipewire-module-loopback";
args = {
"audio.position" = [ "FL,FR" ];
"capture.props" = {
"media.class" = "Audio/Sink";
"node.name" = "ledfx.input";
"node.description" = "ledfx capture";
};
"playback.props" = {
"media.class" = "Audio/Source";
"node.name" = "ledfx.output";
"node.passive" = true;
};
};
}
];
};
systemd.services.snapclient-ledfx = {
enable = true;
description = "Snapcast client";
@ -15,8 +38,8 @@ in
wantedBy = [ "multi-user.target" ];
serviceConfig = {
DynamicUser = "yes";
ExecStart = "${pkgs.snapcast}/bin/snapclient --host 127.0.0.1 --hostID ledfx -i 2 --player alsa -s ledfx";
Group = "audio";
ExecStart = "${pkgs.snapcast}/bin/snapclient --host 127.0.0.1 --hostID ledfx -i 2 --player pulse -s ledfx.input";
Group = "pipewire";
NoNewPrivileges = true;
ProtectControlGroups = true;
ProtectHome = true;
@ -37,7 +60,7 @@ in
serviceConfig = {
DynamicUser = "yes";
ExecStart = "${pkgs.ledfx}/bin/ledfx --host 0.0.0.0 -p 8888 -c %S/ledfx";
Group = "audio";
Group = "pipewire";
NoNewPrivileges = true;
ProtectControlGroups = true;
ProtectHome = true;

View file

@ -7,10 +7,11 @@
wants = [ "network.target" "sound.target" ];
after = [ "network.target" "sound.target" ];
wantedBy = [ "multi-user.target" ];
environment.PULSE_SERVER = "unix:/run/pulse/native";
serviceConfig = {
DynamicUser = "yes";
ExecStart = "${pkgs.snapcast}/bin/snapclient --host 127.0.0.1 -s DAC";
Group = "audio";
ExecStart = "${pkgs.snapcast}/bin/snapclient --host 127.0.0.1 --player pulse -s alsa_output.usb-Burr-Brown_from_TI_USB_Audio_DAC-00.analog-stereo";
Group = "pipewire";
NoNewPrivileges = true;
ProtectControlGroups = true;
ProtectHome = true;