24 lines
703 B
Nix
24 lines
703 B
Nix
{ pkgs, ... }:
|
|
let
|
|
process-media-controls = pkgs.writeText "process-media-controls"
|
|
(builtins.readFile ./process-media-controls.py);
|
|
in {
|
|
systemd.services.process-media-controls = {
|
|
requires = [ "network.target" "pulseaudio.service" ];
|
|
after = [ "network.target" "pulseaudio.service" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
path = [ pkgs.pulseaudio ];
|
|
script = let
|
|
python = pkgs.python39.withPackages
|
|
(ps: with ps; [ pkgs.python39Packages.evdev ]);
|
|
in ''
|
|
export PULSE_SERVER=127.0.0.1
|
|
(${python.interpreter} ${process-media-controls}) || true
|
|
'';
|
|
serviceConfig = {
|
|
Restart = "always";
|
|
StartLimitAction = "none";
|
|
};
|
|
};
|
|
}
|