mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:36 +01:00
* feat(vinput): read provider keys from an EnvironmentFile * feat(vinput): manage the config from this repository
65 lines
2.2 KiB
Nix
65 lines
2.2 KiB
Nix
{
|
|
inputs,
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.modules.desktop.vinput;
|
|
vinput = inputs.fcitx5-vinput.packages.${pkgs.stdenv.hostPlatform.system}.fcitx5-vinput;
|
|
in
|
|
{
|
|
options.modules.desktop.vinput.enable = lib.mkEnableOption "Fcitx5 Vinput voice input";
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
i18n.inputMethod.fcitx5.addons = [ vinput ];
|
|
|
|
# MenuKey opens the command palette; set it to right Ctrl. `CommandKeys`
|
|
# (voice command on the selection) defaults to right Ctrl and outranks
|
|
# `MenuKey`, so clear it or the palette never opens. List options use
|
|
# fcitx5's `[Option]` + `0=` form, not upstream's `[Trigger]` shorthand.
|
|
xdg.configFile."fcitx5/conf/vinput.conf" = {
|
|
text = ''
|
|
[MenuKey]
|
|
0=Control_R
|
|
|
|
[CommandKeys]
|
|
'';
|
|
# fcitx5 rewrites this file at runtime, like `profile` and `config`.
|
|
force = true;
|
|
};
|
|
|
|
# The daemon rewrites this itself (the GUI, `vinput scene edit`) and resolves symlinks before
|
|
# writing, so the link keeps those edits in the checkout instead of a read-only store copy.
|
|
# `force` retakes the path if a write ever leaves a real file there. See the README.
|
|
xdg.configFile."vinput/config.json" = {
|
|
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nix-config/home/linux/gui/base/vinput/config.json";
|
|
force = true;
|
|
};
|
|
|
|
systemd.user.services.vinput-daemon = {
|
|
Unit = {
|
|
Description = "Fcitx5 Vinput voice input daemon";
|
|
After = [ "pipewire.service" ];
|
|
PartOf = [ "graphical-session.target" ];
|
|
};
|
|
Service = {
|
|
Type = "dbus";
|
|
BusName = "org.fcitx.Vinput";
|
|
ExecStart = "${vinput}/bin/vinput-daemon";
|
|
|
|
# Provider keys are `{{env.*}}` references the daemon resolves from its own environment,
|
|
# and a systemd user service inherits neither the interactive shell's environment nor any
|
|
# app's env file. No `-` prefix: a host without the file is misconfigured, not
|
|
# half-working, and the daemon logs "unset or empty" without it.
|
|
EnvironmentFile = "%h/.secrets/nushell-secrets.env";
|
|
|
|
Restart = "on-failure";
|
|
RestartSec = 3;
|
|
};
|
|
Install.WantedBy = [ "graphical-session.target" ];
|
|
};
|
|
};
|
|
}
|