diff --git a/flake.nix b/flake.nix index 2fe1c26..f270ee9 100644 --- a/flake.nix +++ b/flake.nix @@ -111,6 +111,7 @@ ./modules/common/linux (common-nix stable) inputs.secrets.nixosModules.common + inputs.nix-gaming.nixosModules.pipewireLowLatency ]; }; diff --git a/modules/common/linux/default.nix b/modules/common/linux/default.nix index 2a90f6b..0d43ac7 100644 --- a/modules/common/linux/default.nix +++ b/modules/common/linux/default.nix @@ -153,6 +153,14 @@ in alsa.support32Bit = true; pulse.enable = true; + + lowLatency = { + # enable this module + enable = true; + # defaults (no need to be set unless modified) + quantum = 64; + rate = 48000; + }; }; # udev configurations services.udev.packages = with pkgs; [ diff --git a/nki-home/audio/default.nix b/nki-home/audio/default.nix new file mode 100644 index 0000000..99a7463 --- /dev/null +++ b/nki-home/audio/default.nix @@ -0,0 +1,5 @@ +{ config, pkgs, lib, ... }: { + environment.etc = { + "wireplumber/main.lua.d/51-sdac.lua".source = ./sdac.lua; + }; +} diff --git a/nki-home/audio/sdac.lua b/nki-home/audio/sdac.lua new file mode 100644 index 0000000..2c172d6 --- /dev/null +++ b/nki-home/audio/sdac.lua @@ -0,0 +1,16 @@ +rule = { + matches = { + { + { "node.name", "matches", "alsa_output.usb-Grace_Design_SDAC-00.*" }, + }, + }, + apply_properties = { + ["audio.format"] = "S24_3LE", + ["audio.rate"] = 96000, + ["api.alsa.period-size"] = 2, + ["api.alsa.headroom"] = 0, + ["api.alsa.disable-batch"] = true + }, +} + +table.insert(alsa_monitor.rules, rule) diff --git a/nki-home/hardware-configuration.nix b/nki-home/hardware-configuration.nix index 0b5e484..72a263d 100644 --- a/nki-home/hardware-configuration.nix +++ b/nki-home/hardware-configuration.nix @@ -7,6 +7,7 @@ imports = [ (modulesPath + "/installer/scan/not-detected.nix") + ./audio ]; boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];