system/modules/nixos/configs/sound.nix

35 lines
717 B
Nix

{ config, pkgs, lib, ... }:
let
cfg = config.local.sound;
in
{
options.local.sound = {
enable = lib.mkEnableOption "sound";
systemWide = lib.mkEnableOption "systemWide";
};
config = lib.mkIf cfg.enable {
sound = {
enable = true;
mediaKeys.enable = true;
};
hardware.pulseaudio = lib.mkMerge [
{
enable = true;
package = pkgs.pulseaudioFull;
}
(lib.mkIf cfg.systemWide {
systemWide = true;
support32Bit = true;
tcp = {
enable = true;
anonymousClients.allowedIpRanges = [ "127.0.0.1" ];
};
})
];
networking.firewall.allowedTCPPorts = lib.mkIf cfg.systemWide [ 4713 ];
};
}