{ pkgs, config, lib, ... }: with lib; let cfg = config.eboskma.sound; in { options.eboskma.sound = { enable = mkEnableOption "activate sound settings"; jack = mkEnableOption "enable JACK"; }; config = mkIf cfg.enable { sound.enable = true; services = { pipewire = { enable = true; pulse.enable = true; alsa.enable = true; jack.enable = cfg.jack; wireplumber.enable = true; }; }; environment.etc = { bluez_monitor = mkIf config.eboskma.bluetooth.enable { target = "wireplumber/bluetooth.lua.d/50-bluez-config.lua"; text = '' bluez_monitor.properties = { ["bluez5.enable-msbc"] = true, ["bluez5.enable-sbc-xq"] = true, ["bluez5.headset-roles"] = "[ hfp_hf hsp_hs hsp_ag hfp_ag ]", ["bluez5.codecs"] = "[ sbc sbc_xq aac ]", ["bluez5.hfphsp-backend"] = "native", ["bluez5.default.rate"] = 48000, ["bluez5.default.channels"] = 2, } ''; }; }; security.rtkit.enable = true; environment.systemPackages = with pkgs; [ pavucontrol pipewire ]; users.extraUsers.${config.eboskma.var.mainUser}.extraGroups = [ "audio" ]; }; }