57 lines
1.4 KiB
Nix
57 lines
1.4 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
{
|
|
options.c3d2.audioServer = with lib; {
|
|
enable = mkEnableOption "Enable PulseAudio and Bluetooth sinks";
|
|
};
|
|
|
|
config = lib.mkIf config.c3d2.audioServer.enable {
|
|
# Enable sound.
|
|
sound.enable = true;
|
|
hardware.bluetooth = {
|
|
enable = lib.mkDefault true;
|
|
settings = {
|
|
Policy.AutoEnable = true;
|
|
General = {
|
|
Enable = "Source,Sink,Media,Socket";
|
|
#DiscoverableTimeout = 0;
|
|
#Discoverable = true;
|
|
};
|
|
};
|
|
};
|
|
|
|
hardware.pulseaudio = {
|
|
enable = true;
|
|
systemWide = true;
|
|
tcp.enable = true;
|
|
tcp.anonymousClients.allowedIpRanges = [
|
|
"127.0.0.0/8"
|
|
"::1/128"
|
|
"fd23:42:c3d2:500::/56"
|
|
"172.22.99.0/24"
|
|
"172.20.72.0/21"
|
|
"2a00:8180:2c00:200::/56"
|
|
];
|
|
zeroconf.publish.enable = true;
|
|
package = pkgs.pulseaudioFull;
|
|
extraModules = [ pkgs.pulseaudio-modules-bt ];
|
|
};
|
|
#services.pipewire = {
|
|
# enable = true;
|
|
# alsa.enable = true;
|
|
# config.pipewire-pulse = lib.importJSON ./pipewire-pulse.conf.json;
|
|
# pulse.enable = true;
|
|
#};
|
|
security.rtkit.enable = true;
|
|
|
|
# tell Avahi to publish CUPS and PulseAudio
|
|
services.avahi = {
|
|
enable = true;
|
|
publish = {
|
|
enable = true;
|
|
addresses = true;
|
|
userServices = true;
|
|
};
|
|
};
|
|
};
|
|
}
|