2021-05-25 17:59:18 +02:00
|
|
|
{ config, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.my.modules.sound;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.my.modules.sound = with lib; {
|
|
|
|
enable = mkEnableOption "sound configuration";
|
|
|
|
|
2021-05-25 18:17:39 +02:00
|
|
|
pipewire = {
|
|
|
|
enable = mkEnableOption "pipewire configuration";
|
|
|
|
};
|
|
|
|
|
2021-05-25 17:59:18 +02:00
|
|
|
pulse = {
|
|
|
|
enable = mkEnableOption "pulseaudio configuration";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable (lib.mkMerge [
|
|
|
|
# Basic configuration
|
|
|
|
{
|
|
|
|
sound.enable = true;
|
|
|
|
}
|
|
|
|
|
2021-05-25 18:17:39 +02:00
|
|
|
(lib.mkIf cfg.pipewire.enable {
|
|
|
|
# RealtimeKit is recommended
|
|
|
|
security.rtkit.enable = true;
|
|
|
|
|
|
|
|
services.pipewire = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
alsa = {
|
|
|
|
enable = true;
|
|
|
|
support32Bit = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
pulse = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
jack = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
media-session = {
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
|
2021-05-25 17:59:18 +02:00
|
|
|
# Pulseaudio setup
|
|
|
|
(lib.mkIf cfg.pulse.enable {
|
|
|
|
hardware.pulseaudio.enable = true;
|
|
|
|
})
|
|
|
|
]);
|
|
|
|
}
|