nixos-config/config/programs/plover.nix

84 lines
2.3 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-07-06 18:25:34 +00:00
nix-packages,
2022-06-12 15:39:15 +00:00
...
}: let
2022-07-08 12:15:54 +00:00
inherit (pkgs) plover plover-plugins-manager plover-emoji plover-tapey-tape plover-yaml-dictionary;
2022-07-06 13:07:54 +00:00
plover-env = plover.pythonModule.withPackages (_: [plover plover-plugins-manager plover-emoji plover-tapey-tape plover-yaml-dictionary]);
2022-06-16 20:47:46 +00:00
plover-src = plover.src;
2022-07-06 18:25:34 +00:00
plover-dictionaries-english =
[
{
enabled = true;
2022-07-09 18:50:23 +00:00
path = "tmpdic.yaml";
}
{
enabled = true;
2022-07-09 19:12:39 +00:00
path = ../../extra/user.yaml;
2022-07-06 18:25:34 +00:00
}
]
++ (map (module: {
enabled = true;
path = nix-packages.packages.${system}."plover-dict-${module}";
}) [
2022-07-09 11:57:25 +00:00
#Put this first
"fingerspelling"
# put these in alphabetical order
2022-07-06 18:25:34 +00:00
"abbreviations"
"briefs"
2022-07-07 10:50:56 +00:00
"computer-use"
2022-07-06 18:25:34 +00:00
"currency"
"dict"
2022-07-07 10:50:56 +00:00
"modifiers-single-stroke"
"navigation"
2022-07-06 18:25:34 +00:00
"nouns"
"numbers"
"numbers-powerups"
2022-07-07 10:50:56 +00:00
"plover-use"
2022-07-06 18:25:34 +00:00
"proper-nouns"
"punctuation-powerups"
"punctuation-unspaced"
2022-07-07 10:50:56 +00:00
"punctuation"
2022-07-06 18:25:34 +00:00
"symbols"
"symbols-briefs"
"symbols-currency"
2022-07-07 10:50:56 +00:00
"tabbing"
2022-07-06 18:25:34 +00:00
"top-level-domains"
# Put these last
"condensed-strokes"
]);
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-07-07 10:51:48 +00:00
Plugins.enabled_extensions = builtins.toJSON ["plover_tapey_tape"];
});
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
}