{ lib, config, pkgs, ... }:

with lib;

let
  cfg = config.roles.audio;
in
{
  options.roles.audio = {
    enable = mkEnableOption "Enable the audio role";
  };

  config = mkIf cfg.enable
    {
      environment.systemPackages = with pkgs; [
        easyeffects
        paprefs
        pavucontrol
        pulsemixer
      ];

      services.pipewire = {
        enable = true;
        pulse.enable = true;
      };

      services.pulseaudio = {
        package = pkgs.pulseaudioFull;
        extraConfig = ''
          load-module module-combine-sink
          load-module module-switch-on-connect
        '';
      };

      services.squeezelite = {
        #enable = true;
        pulseAudio = true;
      };
    };

}
