nixos-config/config/programs/plover.nix

64 lines
1.8 KiB
Nix
Raw Normal View History

2022-06-12 15:39:15 +00:00
{
lib,
pkgs,
2022-06-16 20:47:46 +00:00
system,
2022-06-12 15:39:15 +00:00
...
}: let
2022-06-18 08:23:53 +00:00
inherit (pkgs) plover plover-plugins-manager regenpfeifer plover-regenpfeifer;
2022-06-28 15:50:02 +00:00
plover-env = plover.pythonModule.withPackages (_: [plover plover-plugins-manager]);
2022-06-16 20:47:46 +00:00
plover-src = plover.src;
2022-06-18 08:57:25 +00:00
plover-dictionaries-english = [
{
enabled = true;
path = pkgs.writeText "user.json" (builtins.toJSON {
"SER/TKPWAL" = "Sergal";
"SERLG" = "Sergal";
"SER/SRAL" = "serval";
2022-06-19 05:41:35 +00:00
"SOL/DER" = "solder";
2022-06-20 08:53:21 +00:00
"KWREUF" = "yiff";
"KWR*EUF" = "I didn't have";
2022-06-20 06:32:37 +00:00
"PWA/TPHA/TPHAS" = "bananas";
"PWA/TPHA/TPHAZ" = "bananas";
});
}
{
enabled = true;
path = "${plover-src}/plover/assets/commands.json";
}
{
enabled = true;
path = "${plover-src}/plover/assets/main.json";
}
];
2022-06-12 15:39:15 +00:00
plover-cfg = pkgs.writeText "plover.cfg" (lib.generators.toINI {} {
"Machine Configuration".machine_type = "Keyboard";
"System: English Stenotype" = {
2022-06-18 08:57:25 +00:00
dictionaries = builtins.toJSON plover-dictionaries-english;
};
});
2022-06-12 15:39:15 +00:00
in {
2022-01-24 09:06:57 +00:00
home.packages = [
2022-06-18 08:23:53 +00:00
plover-env
2022-01-24 09:06:57 +00:00
];
2022-06-12 15:39:15 +00:00
home.activation.ploverSettings = lib.hm.dag.entryAfter ["writeBoundary"] ''
$DRY_RUN_CMD mkdir $VERBOSE_ARG -p $HOME/.config/plover
$DRY_RUN_CMD rm -f $HOME/.config/plover/plover.cfg
$DRY_RUN_CMD cp $VERBOSE_ARG ${plover-cfg} $HOME/.config/plover/plover.cfg
$DRY_RUN_CMD chmod +w $VERBOSE_ARG $HOME/.config/plover/plover.cfg
2022-06-01 16:59:56 +00:00
'';
systemd.user.services.plover = {
Unit = {
Description = "plover";
2022-06-12 15:39:15 +00:00
After = ["tray.target"];
PartOf = ["graphical-session.target"];
Requires = ["tray.target"];
};
Install = {
2022-06-12 15:39:15 +00:00
WantedBy = ["graphical-session.target"];
};
Service = {
2022-06-18 08:43:06 +00:00
ExecStart = "${plover-env}/bin/plover";
2022-03-04 19:20:54 +00:00
};
};
2022-01-24 09:06:57 +00:00
}