nixos-config/config/programs/plover.nix

94 lines
2.7 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-06 13:07:54 +00:00
inherit (pkgs) plover plover-plugins-manager regenpfeifer plover-regenpfeifer plover-emoji plover-tapey-tape plover-yaml-dictionary;
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;
path = pkgs.writeText "user.json" (builtins.toJSON {
"SER/TKPWAL" = "Sergal";
"SERLG" = "Sergal";
"SER/SRAL" = "serval";
"SOL/TKER" = "solder";
"KWREUF" = "yiff";
"KWR*EUF" = "I didn't have";
"PWA/TPHA/TPHAS" = "bananas";
"PWA/TPHA/TPHAZ" = "bananas";
"HROT/TE" = "Lotte";
"TPUR/SO/TPHA" = "fursona";
2022-07-06 19:16:16 +00:00
"TPWH" = "to be honest";
"TPWH*" = "tbh";
2022-07-07 11:12:52 +00:00
"PWRU" = "bruh";
2022-07-06 18:25:34 +00:00
});
}
]
++ (map (module: {
enabled = true;
path = nix-packages.packages.${system}."plover-dict-${module}";
}) [
"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
"fingerspelling"
"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-10000-project-gutenberg-words"
"top-level-domains"
# Put these last
"condensed-strokes"
"condensed-strokes-fingerspelled"
]);
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
}