summaryrefslogtreecommitdiffstats
path: root/modules/hardware/audio.nix
blob: d70b1d28e033860426f834143e3beecdb9de007d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{
    config,
    options,
    lib,
    pkgs,
    ...
}: let
    audioConfig = config.modules.hardware.audio;
    device = config.modules.device;
in {
    options.modules.hardware.audio = {
        enable = lib.mkOption {
            type = lib.types.bool;
            default = true;
        };
    };

    config = lib.mkIf (audioConfig.enable) (lib.mkMerge [
        {
            security.rtkit.enable = true;
            services.pipewire = {
                enable = true;
                alsa.enable = true;
                alsa.support32Bit = true;
                pulse.enable = true;

                wireplumber.extraConfig.bluetoothEnhancements = {
                  "monitor.bluez.properties" = {
                  "bluez5.enable-sbc-xq" = true;
                  "bluez5.enable-msbc" = true;
                  "bluez5.enable-hw-volume" = true;
                  "bluez5.roles" = [ "hsp_hs" "hsp_ag" "hfp_hf" "hfp_ag" "a2dp_source" "bap_source" ];
                };
              };
            };

            environment.systemPackages = with pkgs; [
                alsa-firmware
                alsa-oss
                alsa-ucm-conf
            ];

            hardware.alsa.enablePersistence = true;

            user.extraGroups = ["audio"];
            home.packages = [pkgs.pavucontrol];
          }
    ]);
}