From 09b0a8ef715d46296e1865adf95cfa9503fd6487 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Mon, 11 Mar 2024 21:02:32 -0500 Subject: modules: add hardware.asahi.enable (true by default) --- apple-silicon-support/modules/sound/default.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'apple-silicon-support/modules/sound') 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; -- cgit 1.4.1