nix-infra/common/fragments/graphical/audio.nix

91 lines
2.3 KiB
Nix

{ pkgs, lib, ... }: {
# Pipewire
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
programs.noisetorch.enable = true;
systemd.user.services."noisetorch" = {
description =
"Virtual microphone device with noise supression for PulseAudio";
after = [ "graphical-session-pre.target" ];
partOf = [ "graphical-session.target" "pipewire.service" ];
wantedBy = [ "graphical-session.target" ];
serviceConfig = {
ExecStart = "${pkgs.noisetorch}/bin/noisetorch -i";
ExecStop = "${pkgs.noisetorch}/bin/noisetorch -u";
Restart = "on-failure";
RestartSec = 5;
RemainAfterExit = true;
};
};
# User packages
users.users.agatha.packages = with pkgs; [ pamixer pavucontrol playerctl ];
home-manager.users.agatha = {
services.easyeffects = {
enable = true;
preset = "DT-770-flat-eq";
};
xdg.configFile."easyeffects/output/DT-770-flat-eq.json".text = let
band = num: freq: gain: ''
"band${toString num}": {
"frequency": ${toString freq},
"gain": ${toString gain},
"mode": "RLC (BT)",
"mute": false,
"q": 1.41,
"slope": "x1",
"solo": false,
"type": "Bell"
}
'';
bands = lib.concatStringsSep ''
,
'' [
(band 0 31.0 5.8)
(band 1 62.0 8.0)
(band 2 125.0 (-8.03))
(band 3 250.0 (-2.42))
(band 4 500.0 0.71)
(band 5 1000.0 1.67)
(band 6 2000.0 (-2.42))
(band 7 4000.0 7.12)
(band 8 8000.0 (-0.61))
(band 9 16000.0 (-2.58))
];
in ''
{
"output": {
"blocklist": [],
"equalizer": {
"input-gain": 0.0,
"left": {
${bands}
},
"mode": "IIR",
"num-bands": 10,
"output-gain": 0.0,
"right": {
${bands}
},
"split-channels": false
},
"plugins_order": [
"equalizer"
]
}
}
'';
};
}