71 lines
2.1 KiB
Nix
71 lines
2.1 KiB
Nix
{ lib, config, ... }:
|
|
with lib;
|
|
{
|
|
options.features.sound = {
|
|
enable = mkEnableOption "enable sound and bluetooth stack";
|
|
pipewire = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Enable PipeWire audio stack.";
|
|
};
|
|
alsa32Bit = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Enable 32-bit ALSA support.";
|
|
};
|
|
pulseCompat = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Enable PulseAudio compatibility through PipeWire.";
|
|
};
|
|
};
|
|
bluetooth = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Enable Bluetooth subsystem.";
|
|
};
|
|
powerOnBoot = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Power on Bluetooth at boot.";
|
|
};
|
|
disableHeadsetProfile = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Disable headset profile for Bluetooth devices.";
|
|
};
|
|
bluemanEnable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Enable Blueman service.";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf config.features.sound.enable {
|
|
services.pulseaudio.enable = false;
|
|
security.rtkit.enable = true;
|
|
services = {
|
|
pipewire = {
|
|
enable = config.features.sound.pipewire.enable;
|
|
alsa.enable = config.features.sound.pipewire.enable;
|
|
alsa.support32Bit = config.features.sound.pipewire.alsa32Bit;
|
|
pulse.enable = config.features.sound.pipewire.pulseCompat;
|
|
};
|
|
blueman.enable = config.features.sound.bluetooth.bluemanEnable;
|
|
};
|
|
hardware = {
|
|
bluetooth = mkIf config.features.sound.bluetooth.enable {
|
|
enable = config.features.sound.bluetooth.enable;
|
|
powerOnBoot = config.features.sound.bluetooth.powerOnBoot;
|
|
settings = {
|
|
General = mkIf config.features.sound.bluetooth.disableHeadsetProfile {
|
|
Disable = "Headset";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|