2022-12-04 13:45:43 +00:00
|
|
|
{pkgs, ...}: let
|
|
|
|
process-media-controls =
|
|
|
|
pkgs.writeText "process-media-controls"
|
2022-01-29 18:06:26 +00:00
|
|
|
(builtins.readFile ./process-media-controls.py);
|
|
|
|
in {
|
|
|
|
systemd.services.process-media-controls = {
|
2022-12-04 13:45:43 +00:00
|
|
|
requires = ["network.target" "pulseaudio.service"];
|
|
|
|
after = ["network.target" "pulseaudio.service"];
|
|
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
path = [pkgs.pulseaudio];
|
2022-01-29 18:06:26 +00:00
|
|
|
script = let
|
2022-12-04 13:45:43 +00:00
|
|
|
python =
|
|
|
|
pkgs.python39.withPackages
|
|
|
|
(ps: with ps; [pkgs.python39Packages.evdev]);
|
2022-01-29 18:06:26 +00:00
|
|
|
in ''
|
|
|
|
export PULSE_SERVER=127.0.0.1
|
|
|
|
(${python.interpreter} ${process-media-controls}) || true
|
|
|
|
'';
|
|
|
|
serviceConfig = {
|
|
|
|
Restart = "always";
|
|
|
|
StartLimitAction = "none";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|