-
-
Notifications
You must be signed in to change notification settings - Fork 640
/
audio.nix
46 lines (41 loc) · 1.12 KB
/
audio.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{ config, lib, pkgs, ... }:
let
cfg = config.hardware.raspberry-pi."4".audio;
in
{
options.hardware = {
raspberry-pi."4".audio = {
enable = lib.mkEnableOption ''
configuration for audio
'';
};
};
config = lib.mkIf cfg.enable {
hardware.deviceTree = {
overlays = [
# Equivalent to dtparam=audio=on
{
name = "audio-on-overlay";
dtsText = ''
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2711";
fragment@0 {
target = <&audio>;
__overlay__ {
status = "okay";
};
};
};
'';
}
];
};
# set tsched=0 in pulseaudio config to avoid audio glitches
# see https://wiki.archlinux.org/title/PulseAudio/Troubleshooting#Glitches,_skips_or_crackling
hardware.pulseaudio.configFile = lib.mkOverride 990 (pkgs.runCommand "default.pa" {} ''
sed 's/module-udev-detect$/module-udev-detect tsched=0/' ${config.hardware.pulseaudio.package}/etc/pulse/default.pa > $out
'');
};
}