41 lines
1.2 KiB
Nix
41 lines
1.2 KiB
Nix
{
|
|
flake.modules.nixos.handy = { pkgs, ... }: {
|
|
services.udev.packages = [
|
|
(pkgs.writeTextDir "lib/udev/rules.d/70-handy-keyboard.rules" ''
|
|
SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT_KEYBOARD}=="1", TAG+="uaccess"
|
|
'')
|
|
];
|
|
};
|
|
|
|
flake.modules.homeManager.handy =
|
|
{ pkgs, ... }:
|
|
let
|
|
python = pkgs.python3.withPackages (ps: [ ps.evdev ]);
|
|
in
|
|
{
|
|
home.packages = [ pkgs.handy ];
|
|
|
|
systemd.user.services.handy = {
|
|
Unit = {
|
|
Description = "Handy dictation";
|
|
PartOf = [ "graphical-session.target" ];
|
|
After = [ "graphical-session.target" ];
|
|
};
|
|
Install.WantedBy = [ "graphical-session.target" ];
|
|
Service = {
|
|
ExecStart = "${pkgs.handy}/bin/handy --start-hidden";
|
|
};
|
|
};
|
|
|
|
systemd.user.services.handy-ptt = {
|
|
Unit = {
|
|
Description = "Handy push-to-talk key release listener";
|
|
PartOf = [ "graphical-session.target" ];
|
|
Requisite = [ "handy.service" ];
|
|
After = [ "handy.service" ];
|
|
};
|
|
Service.ExecStart = "${python}/bin/python ${./handy/_push_to_talk.py} ${pkgs.handy}/bin/handy";
|
|
};
|
|
};
|
|
}
|