neptune: lan hosts can stream audio to speakers

This commit is contained in:
vi
2025-12-01 00:00:00 +00:00
parent 3eeb11571d
commit f8f8731303
3 changed files with 63 additions and 0 deletions

View File

@@ -169,6 +169,17 @@
};
roles.default.machines.b4l = { };
};
pulse-stream = {
module = {
name = "pulse-stream";
input = "self";
};
roles.default.machines.neptune = {
settings.client-ip-ranges = [
"10.0.0.0/24"
];
};
};
};
};
};

View File

@@ -0,0 +1,43 @@
{ ... }:
{
_class = "clan.service";
manifest.name = "pulse-stream";
manifest.description = "stream audio to attached speakers";
manifest.categories = [ "System" ];
roles.default = {
interface =
{ lib, ... }:
{
options.client-ip-ranges = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "ip subnets permitted to stream to the server";
default = [];
};
};
perInstance =
{
roles,
settings,
...
}:
{
nixosModule =
{ ... }:
{
services.pulseaudio = {
enable = true;
systemWide = true;
tcp = {
enable = true;
anonymousClients.allowedIpRanges =
settings.client-ip-ranges;
anonymousClients.allowAll = true;
};
zeroconf.publish.enable = true;
};
networking.firewall.allowedTCPPorts = [ 4713 ];
};
};
};
}

View File

@@ -0,0 +1,9 @@
{ lib, ... }:
let
module = lib.modules.importApply ./default.nix { };
in
{
clan.modules = {
pulse-stream = module;
};
}