From 1be09af058424219de2aad4b9cc27ccf760d23f6 Mon Sep 17 00:00:00 2001 From: adikro Date: Sun, 1 Mar 2026 19:57:16 +0100 Subject: ... --- os/core/audio.nix | 49 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) (limited to 'os/core/audio.nix') diff --git a/os/core/audio.nix b/os/core/audio.nix index 2454a89..5b9607c 100644 --- a/os/core/audio.nix +++ b/os/core/audio.nix @@ -2,14 +2,18 @@ config, lib, pkgs, + username, ... -}: let +}: +let cfg = config.os.core.audio; -in { +in +{ options.os.core.audio = { enable = lib.mkEnableOption "audio support"; disable-devices.enable = lib.mkEnableOption "disables some random devices cluttering up"; }; + config = lib.mkMerge [ (lib.mkIf cfg.enable { services = { @@ -21,10 +25,27 @@ in { alsa.support32Bit = true; jack.enable = true; wireplumber.enable = true; + + # wireplumber.extraConfig."10-force-input-awake" = { + # "monitor.alsa.rules" = [ + # { + # matches = [ + # { "node.name" = "~alsa_input.*HyperX.*"; } + # { "node.name" = "~alsa_output.*HyperX.*"; } + # ]; + # actions.update-props = { + # "session.suspend-on-idle" = false; + # }; + # } + # ]; + # }; }; playerctld.enable = true; spotifyd.enable = true; }; + + users.users.${username}.linger = true; + security.rtkit.enable = true; hardware.enableAllFirmware = true; @@ -32,30 +53,26 @@ in { helvum alsa-utils ]; + + # boot.kernelParams = [ "usbcore.autosuspend=-1" ]; + # boot.extraModprobeConfig = '' + # options snd-usb-audio power_save=0 + # ''; }) + (lib.mkIf cfg.disable-devices.enable { services.pipewire.wireplumber.extraConfig = { - "10-keep-hyperx-alive"."monitor.alsa.rules" = [ + "99-disable-useless-devices"."monitor.alsa.rules" = [ { matches = [ - {"device.description" = "~HyperX*";} + { "device.name" = "~alsa_card.pci-0000_03_00.1*"; } + { "device.description" = "~USB Audio*"; } ]; actions.update-props = { - "device.disabled" = false; - "session.suspend-on-idle" = false; + "device.disabled" = true; }; } ]; - - "99-disable-useless-devices"."monitor.alsa.rules" = [ - { - matches = [ - {"device.name" = "~alsa_card.pci-0000_03_00.1*";} - {"device.description" = "~USB Audio*";} - ]; - actions.update-props = {"device.disabled" = true;}; - } - ]; }; }) ]; -- cgit v1.3