mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-12-27 09:08:47 +01:00
pipewire: Inline low latency module
This removes the nix-gaming dependency to achieve low latency.
This commit is contained in:
parent
6d5365f2b3
commit
1dcf95a7eb
@ -1,4 +1,3 @@
|
||||
{ nix-gaming, ... }:
|
||||
let VARIABLES = import ../src/variables.nix; in {
|
||||
containers.wine = {
|
||||
privateNetwork = true;
|
||||
@ -36,9 +35,9 @@ let VARIABLES = import ../src/variables.nix; in {
|
||||
|
||||
config = { pkgs, ... }: {
|
||||
imports = [
|
||||
nix-gaming.nixosModules.pipewireLowLatency
|
||||
../modules/pipewire.nix
|
||||
];
|
||||
|
||||
programs = {
|
||||
fish.enable = true;
|
||||
neovim.enable = true;
|
||||
|
@ -1,10 +1,9 @@
|
||||
{ home-manager, stylix, nix-gaming, ... }:
|
||||
{ home-manager, stylix, ... }:
|
||||
|
||||
let VARIABLES = import ./src/variables.nix; in {
|
||||
imports = [
|
||||
home-manager.nixosModules.home-manager
|
||||
stylix.nixosModules.stylix
|
||||
nix-gaming.nixosModules.pipewireLowLatency
|
||||
"${VARIABLES.hostHardwareConfiguration}"
|
||||
./containers
|
||||
./home
|
||||
|
@ -1,4 +1,11 @@
|
||||
{ pkgs, ... }: {
|
||||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
quantum = 64;
|
||||
rate = 48000;
|
||||
qr = "${toString quantum}/${toString rate}";
|
||||
json = pkgs.formats.json {};
|
||||
in {
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
|
||||
@ -8,8 +15,6 @@
|
||||
};
|
||||
|
||||
pulse.enable = true;
|
||||
|
||||
lowLatency.enable = true;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
@ -17,4 +22,52 @@
|
||||
];
|
||||
|
||||
security.rtkit.enable = true;
|
||||
|
||||
environment.etc = {
|
||||
"pipewire/pipewire.d/99-lowlatency.conf".source = json.generate "99-lowlatency.conf" {
|
||||
context.properties.default.clock.min-quantum = quantum;
|
||||
};
|
||||
|
||||
"pipewire/pipewire-pulse.d/99-lowlatency.conf".source = json.generate "99-lowlatency.conf" {
|
||||
context.modules = [
|
||||
{
|
||||
name = "libpipewire-module-rtkit";
|
||||
args = {
|
||||
nice.level = -15;
|
||||
rt.prio = 88;
|
||||
rt.time.soft = 200000;
|
||||
rt.time.hard = 200000;
|
||||
};
|
||||
flags = ["ifexists" "nofail"];
|
||||
}
|
||||
{
|
||||
name = "libpipewire-module-protocol-pulse";
|
||||
args = {
|
||||
pulse.min.req = qr;
|
||||
pulse.min.quantum = qr;
|
||||
pulse.min.frag = qr;
|
||||
server.address = ["unix:native"];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
stream.properties = {
|
||||
node.latency = qr;
|
||||
resample.quality = 1;
|
||||
};
|
||||
};
|
||||
|
||||
"wireplumber/main.lua.d/99-alsa-lowlatency.lua".text = /* lua */ ''
|
||||
alsa_monitor.rules = {
|
||||
{
|
||||
matches = {{{ "node.name", "matches", "alsa_output.*" }}};
|
||||
apply_properties = {
|
||||
["audio.format"] = "S32LE",
|
||||
["audio.rate"] = ${toString (rate * 2)},
|
||||
["api.alsa.period-size"] = 2,
|
||||
},
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user