modules: hardware: sound: refactor options
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Do not enable ALSA when using pipewire. Ensure that both pulseaudio and pipewire are not configured at the same time.
This commit is contained in:
parent
57717d70ef
commit
5abe4e929e
|
@ -1,8 +1,6 @@
|
|||
{ ... }:
|
||||
{
|
||||
my.hardware.sound = {
|
||||
enable = true;
|
||||
|
||||
pipewire = {
|
||||
enable = true;
|
||||
};
|
||||
|
|
|
@ -4,8 +4,6 @@ let
|
|||
in
|
||||
{
|
||||
options.my.hardware.sound = with lib; {
|
||||
enable = mkEnableOption "sound configuration";
|
||||
|
||||
pipewire = {
|
||||
enable = mkEnableOption "pipewire configuration";
|
||||
};
|
||||
|
@ -15,10 +13,21 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||
# Basic configuration
|
||||
config = (lib.mkMerge [
|
||||
# Sanity check
|
||||
{
|
||||
sound.enable = true;
|
||||
assertions = [
|
||||
{
|
||||
assertion = builtins.all (lib.id) [
|
||||
(cfg.pipewire.enable -> !cfg.pulse.enable)
|
||||
(cfg.pulse.enable -> !cfg.pipewire.enable)
|
||||
];
|
||||
message = ''
|
||||
`config.my.hardware.sound.pipewire.enable` and
|
||||
`config.my.hardware.sound.pulse.enable` are incompatible.
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
(lib.mkIf cfg.pipewire.enable {
|
||||
|
@ -49,6 +58,9 @@ in
|
|||
|
||||
# Pulseaudio setup
|
||||
(lib.mkIf cfg.pulse.enable {
|
||||
# ALSA
|
||||
sound.enable = true;
|
||||
|
||||
hardware.pulseaudio.enable = true;
|
||||
})
|
||||
]);
|
||||
|
|
Loading…
Reference in a new issue