nixos-config/config/programs/plover.nix

83 lines
2.4 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";
});
}
]
++ (map (module: {
enabled = true;
path = nix-packages.packages.${system}."plover-dict-${module}";
}) [
"abbreviations"
"briefs"
"currency"
"dict"
"nouns"
"numbers"
"numbers-powerups"
"proper-nouns"
"punctuation-powerups"
"punctuation-unspaced"
"symbols"
"symbols-briefs"
"symbols-currency"
"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-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
}