1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 18:21:07 +01:00

feat(pipewire): try to do some pulseaudio networking stuff

This commit is contained in:
2024-01-02 10:35:03 +01:00
parent e5a3ce5f8d
commit ef7c53f15b
7 changed files with 23 additions and 42 deletions

View File

@@ -86,6 +86,7 @@ in {
hashedPasswordFile = config.age.secrets.kfm-password.path;
isNormalUser = true;
uid = 1000;
extraGroups = ["pipewire" "audio"];
};
age.secrets = {

View File

@@ -1,9 +1,6 @@
{pkgs, ...}: {
sound.enable = true;
# realtime audio
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa = {
@@ -16,25 +13,19 @@
systemd.user.services.pipewire-pulse.path = [pkgs.pulseaudio];
hardware.pulseaudio = {
enable = false;
package = pkgs.pulseaudioFull;
# copy server:/run/pulse/.config/pulse/cookie to client:~/.config/pulse/cookie to authenticate a client machine
zeroconf.discovery.enable = true;
extraConfig = ''
load-module ${
toString [
"module-tunnel-sink-new"
"server=zaatar.r"
"sink_name=zaatar"
"channels=2"
"rate=44100"
]
}
'';
services.avahi = {
enable = true;
publish.enable = true;
publish.userServices = true;
};
users.users.me.extraGroups = ["pipewire" "audio"];
environment.etc."pipewire/pipewire-pulse.conf.d/50-network-party.conf".text = ''
context.exec = [
{ path = "pactl" args = "load-module module-native-protocol-tcp" }
{ path = "pactl" args = "load-module module-zeroconf-discover" }
{ path = "pactl" args = "load-module module-zeroconf-publish" }
]
'';
environment.systemPackages = [
pkgs.pavucontrol

View File

@@ -12,12 +12,12 @@ in {
./gaslight.nix
./kiosk.nix
./hardware-configuration.nix
./pulseaudio.nix
./home-assistant.nix
./mpd.nix
./grocy.nix
./spotifyd.nix
../../configs/keyboard.nix
../../configs/sound.nix
../../configs/monitoring.nix
../../configs/retiolum.nix
../../configs/printing.nix

View File

@@ -7,7 +7,7 @@
users.extraUsers.kiosk = {
isNormalUser = true;
password = "";
extraGroups = ["audio"];
extraGroups = ["audio" "pipewire"];
};
# TODO https://github.com/cage-kiosk/cage/issues/138
services.cage = {

View File

@@ -36,6 +36,8 @@ in {
};
};
users.users.${config.services.mpd.user}.extraGroups = ["pipewire"];
services.mpd = {
enable = true;
network.listenAddress = "0.0.0.0";
@@ -44,7 +46,7 @@ in {
auto_update "yes"
audio_output {
type "pulse"
type "pipewire"
name "zaatar single room audio system"
}
'';

View File

@@ -1,17 +0,0 @@
{pkgs, ...}: {
sound.enable = true;
environment.systemPackages = [pkgs.ncpamixer];
hardware.pulseaudio = {
package = pkgs.pulseaudioFull;
enable = true;
systemWide = true;
tcp = {
enable = true;
anonymousClients.allowedIpRanges = ["127.0.0.1" "10.243.2.0/24" "192.168.0.0/16"];
};
zeroconf.publish.enable = true;
};
networking.firewall.allowedTCPPorts = [4713];
}

View File

@@ -3,7 +3,10 @@
# mpris is a dbus service for controlling all music players with e.g. playerctl
# I do not need this, because I only interact with the service via Spotify Connect
# otherẃise it will pull in DBus which fails without X11
spotifyd = pkgs.spotifyd.overrideAttrs {withMPris = false;};
spotifyd = pkgs.spotifyd.overrideAttrs {
withMpris = false;
withKeyring = false;
};
};
services.spotifyd = {
@@ -12,7 +15,6 @@
global = {
username_cmd = "cat $CREDENTIALS_DIRECTORY/username";
password_cmd = "cat $CREDENTIALS_DIRECTORY/password";
backend = "pulseaudio";
bitrate = 320;
device_type = "s_t_b"; # set-top box
device_name = config.networking.hostName;
@@ -27,6 +29,8 @@
];
};
networking.firewall.allowedTCPPorts = [4713];
age.secrets = {
spotify-username.file = ../../secrets/spotify-username.age;
spotify-password.file = ../../secrets/spotify-password.age;