aboutsummaryrefslogtreecommitdiff
path: root/modules/desktop/sound.nix
blob: 11c3fc27b979c74f3ea06e17ddc11f860f97f9fe (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
{pkgs, config, lib, ...}:
with lib;

let
  xorg = (elem "xorg" config.sys.graphics.desktopProtocols);
  wayland = (elem "wayland" config.sys.graphics.desktopProtocols);
  desktopMode = xorg || wayland;
in {
  config= mkIf desktopMode {
    sound.enable = true;

    environment.systemPackages = with pkgs; [
      # We install it to get access to pactl. It isn't enabled or run as a service.
      pulseaudio
    ];

    services.pipewire = {
      enable = true;
      # Compatibility shims, adjust according to your needs
      alsa.enable = true;
      alsa.support32Bit = true;
      pulse.enable = true;
      jack.enable = true;
    };
    hardware.pulseaudio.enable = false;
  };
}