summaryrefslogtreecommitdiff
path: root/modules/services/audio.nix
diff options
context:
space:
mode:
authorNatasha Moongrave <natasha@256phi.eu>2026-06-28 13:38:29 +0200
committerNatasha Moongrave <natasha@256phi.eu>2026-06-28 13:38:29 +0200
commitb4c4a64d7be31e7b1d80027548a0f36a34423daa (patch)
tree5101613654a329040605661ff9066e0ed8cb764e /modules/services/audio.nix
parentdaabbebd47d61f8b084ab7f9778376c2de1e1ec7 (diff)
Updated the audio config for all hosts
Diffstat (limited to 'modules/services/audio.nix')
-rw-r--r--modules/services/audio.nix91
1 files changed, 56 insertions, 35 deletions
diff --git a/modules/services/audio.nix b/modules/services/audio.nix
index 2cf4086..a236791 100644
--- a/modules/services/audio.nix
+++ b/modules/services/audio.nix
@@ -8,10 +8,12 @@
lib,
...
}: {
+ security.rtkit.enable = true;
+
services.pipewire = {
enable = true;
- alsa.enable = true;
- pulse.enable = true;
+ alsa.enable = lib.mkDefault true;
+ pulse.enable = lib.mkDefault true;
};
};
flake.nixosModules.herraAudio = {
@@ -19,46 +21,65 @@
lib,
...
}: {
+ imports = [
+ self.nixosModules.pipewire
+ ];
# rtkit is optional but recommended
- security.rtkit.enable = true;
services.pipewire = {
- enable = true;
- alsa.enable = true;
alsa.support32Bit = true;
- pulse.enable = true;
jack.enable = true;
# Lower audio latency
# TODO: Every setup is different, and a lot of factors determine your final latency, like CPU speed, RT/PREEMPTIVE kernels and soundcards supporting different audio formats. That's why 32/48000 isn't always a value that's going to work for everyone. The best way to get everything working is to keep increasing the quant value until you get no crackles (underruns) or until you get audio again (in case there wasn't any). This won't guarantee the lowest possible latency, but will provide a decent one paired with stable audio.
- # extraConfig = {
- # pipewire."92-low-latency" = {
- # "context.properties" = {
- # "default.clock.rate" = 48000;
- # "default.clock.quantum" = 128;
- # "default.clock.min-quantum" = 32;
- # "default.clock.max-quantum" = 256; # Maybe set this to a max of 128 or 256 (as advised by Jade)
- # };
- # };
- #
- # pipewire-pulse."92-low-latency" = {
- # context.modules = [
- # {
- # name = "libpipewire-module-protocol-pulse";
- # args = {
- # pulse.min.req = "32/48000";
- # pulse.default.req = "32/48000";
- # pulse.max.req = "32/48000";
- # pulse.min.quantum = "32/48000";
- # pulse.max.quantum = "256/48000"; # Maybe set this to a max of 128 or 256 (as advised by Jade)
- # };
- # }
- # ];
- # stream.properties = {
- # node.latency = "32/48000";
- # resample.quality = 1;
- # };
- # };
- # };
+ extraConfig = {
+ pipewire."92-low-latency" = {
+ "context.properties" = {
+ "default.clock.rate" = 48000;
+ "default.clock.quantum" = 128;
+ "default.clock.min-quantum" = 64;
+ "default.clock.max-quantum" = 256; # Maybe set this to a max of 128 or 256 (as advised by Jade)
+ };
+ };
+
+ pipewire-pulse."92-low-latency" = {
+ context.modules = [
+ {
+ name = "libpipewire-module-protocol-pulse";
+ args = {
+ pulse.min.req = "64/48000";
+ pulse.default.req = "128/48000";
+ pulse.max.req = "256/48000";
+ pulse.min.quantum = "64/48000";
+ pulse.max.quantum = "256/48000"; # Maybe set this to a max of 128 or 256 (as advised by Jade)
+ };
+ }
+ ];
+ stream.properties = {
+ node.latency = "128/48000";
+ resample.quality = 1;
+ };
+ };
+ };
};
};
+
+ flake.nixosModules.kronosAudio = {
+ pkgs,
+ lib,
+ ...
+ }: {
+ imports = [
+ self.nixosModules.pipewire
+ ];
+ };
+
+ flake.nixosModules.mystraAudio = {
+ pkgs,
+ lib,
+ ...
+ }: {
+ imports = [
+ self.nixosModules.pipewire
+ ];
+ };
}