This commit is contained in:
LavaDesu 2021-05-15 19:23:43 +07:00
parent a0f88304e8
commit 4313ea9351
Signed by: cilly
GPG key ID: 6500251E087653C9
2 changed files with 108 additions and 3 deletions

107
cfg/winter/audio.nix Normal file
View file

@ -0,0 +1,107 @@
{ config, ... }:
let
int = {
quantum = {
min = 128;
def = 256;
max = 2048;
};
rate = 48000;
};
str = {
quantum = {
min = toString int.quantum.min;
def = toString int.quantum.def;
max = toString int.quantum.max;
};
rate = toString int.rate;
};
in {
sound.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
config.pipewire = {
"context.properties" = {
"link.max-buffers" = 16;
"default.clock.rate" = int.rate;
"default.clock.quantum" = int.quantum.def;
"default.clock.min-quantum" = int.quantum.min;
"default.clock.max-quantum" = int.quantum.max;
"core.daemon" = true;
"core.name" = "pipewire-0";
};
"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-native"; }
{ name = "libpipewire-module-profiler"; }
{ name = "libpipewire-module-metadata"; }
{ name = "libpipewire-module-spa-device-factory"; }
{ name = "libpipewire-module-spa-node-factory"; }
{ name = "libpipewire-module-client-node"; }
{ name = "libpipewire-module-client-device"; }
{
name = "libpipewire-module-portal";
flags = [ "ifexists" "nofail" ];
}
{ name = "libpipewire-module-access"; args = {}; }
{ name = "libpipewire-module-adapter"; }
{ name = "libpipewire-module-link-factory"; }
{ name = "libpipewire-module-session-manager"; }
];
"stream.properties" = {
"node.latency" = "${str.quantum.min}/${str.rate}";
"resample.quality" = 1;
};
};
config.pipewire-pulse = {
"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-native"; }
{ name = "libpipewire-module-client-node"; }
{ name = "libpipewire-module-adapter"; }
{ name = "libpipewire-module-metadata"; }
{
name = "libpipewire-module-protocol-pulse";
args = {
"pulse.min.req" = "${str.quantum.min}/${str.rate}";
"pulse.default.req" = "${str.quantum.def}/${str.rate}";
"pulse.max.req" = "${str.quantum.max}/${str.rate}";
"pulse.min.quantum" = "${str.quantum.min}/${str.rate}";
"pulse.max.quantum" = "${str.quantum.max}/${str.rate}";
"server.address" = [ "unix:native" ];
};
}
];
"stream.properties" = {
"node.latency" = "${str.quantum.min}/${str.rate}";
"resample.quality" = 1;
};
};
};
}

View file

@ -5,6 +5,7 @@
environment.etc."machine-id".source = "/mnt/bcachefs/machine-id";
imports = [
./audio.nix
./gui.nix
./hardware-configuration.nix
./kernel.nix
@ -31,9 +32,6 @@
# time.timeZone = "";
i18n.defaultLocale = "en_GB.UTF-8";
sound.enable = true;
hardware.pulseaudio.enable = true;
users.mutableUsers = false;
users.users.lava = {
isNormalUser = true;