about summary refs log tree commit diff
path: root/apple-silicon-support/modules/sound/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'apple-silicon-support/modules/sound/default.nix')
-rw-r--r--apple-silicon-support/modules/sound/default.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/apple-silicon-support/modules/sound/default.nix b/apple-silicon-support/modules/sound/default.nix
index 38e412b9e174..d76e7138d4c9 100644
--- a/apple-silicon-support/modules/sound/default.nix
+++ b/apple-silicon-support/modules/sound/default.nix
@@ -5,13 +5,13 @@
     # disable pulseaudio as the Asahi sound infrastructure can't use it.
     # if we disable it only if setupAsahiSound is enabled, then infinite
     # recursion results as pulseaudio enables config.sound by default.
-    { config.hardware.pulseaudio.enable = false; }
+    { config.hardware.pulseaudio.enable = (!config.hardware.asahi.enable); }
   ];
 
   options.hardware.asahi = {
     setupAsahiSound = lib.mkOption {
       type = lib.types.bool;
-      default = config.sound.enable;
+      default = config.sound.enable && config.hardware.asahi.enable;
       description = ''
         Set up the Asahi DSP components so that the speakers and headphone jack
         work properly and safely.
@@ -20,6 +20,8 @@
   };
 
   config = let
+    cfg = config.hardware.asahi;
+
     asahi-audio = pkgs.asahi-audio; # the asahi-audio we use
 
     lsp-plugins = pkgs.lsp-plugins; # the lsp-plugins we use
@@ -39,7 +41,7 @@
     newHotness = builtins.hasAttr "configPackages" options.services.pipewire;
 
     lv2Path = lib.makeSearchPath "lib/lv2" [ lsp-plugins pkgs.bankstown-lv2 ];
-  in lib.mkIf config.hardware.asahi.setupAsahiSound (lib.mkMerge [
+  in lib.mkIf (cfg.setupAsahiSound && cfg.enable) (lib.mkMerge [
     {
       # enable pipewire to run real-time and avoid audible glitches
       security.rtkit.enable = true;