diff options
author | Sandro <sandro.jaeckel@gmail.com> | 2022-05-03 09:35:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-03 09:35:04 +0200 |
commit | e76dd5230fc8d55476cda26d97aad887c10f2ee5 (patch) | |
tree | 8e809009bae2f1b2a3762756888e77fd6c9278b5 /nixos | |
parent | 86a6908045c6a6c613e6a94b447c95846408fde3 (diff) | |
parent | 2474c8c89a3af7c88a653fc040056d600414307b (diff) |
Merge pull request #167032 from Vonfry/feature/fcitx5/rime/with-custom-data-dirs
fcitx5-rime: support custom data dir from environment variable for nixos and nix specially
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/i18n/input-method/fcitx5.nix | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/nixos/modules/i18n/input-method/fcitx5.nix b/nixos/modules/i18n/input-method/fcitx5.nix index 6fea28e22345a..b4b887606e95e 100644 --- a/nixos/modules/i18n/input-method/fcitx5.nix +++ b/nixos/modules/i18n/input-method/fcitx5.nix @@ -5,7 +5,9 @@ with lib; let im = config.i18n.inputMethod; cfg = im.fcitx5; - fcitx5Package = pkgs.fcitx5-with-addons.override { inherit (cfg) addons; }; + addons = cfg.addons ++ optional cfg.enableRimeData pkgs.rime-data; + fcitx5Package = pkgs.fcitx5-with-addons.override { inherit addons; }; + whetherRimeDataDir = any (p: p.pname == "fcitx5-rime") cfg.addons; in { options = { i18n.inputMethod.fcitx5 = { @@ -17,16 +19,29 @@ in { Enabled Fcitx5 addons. ''; }; + + enableRimeData = mkEnableOption "default rime-data with fcitx5-rime"; }; }; config = mkIf (im.enabled == "fcitx5") { i18n.inputMethod.package = fcitx5Package; - environment.variables = { - GTK_IM_MODULE = "fcitx"; - QT_IM_MODULE = "fcitx"; - XMODIFIERS = "@im=fcitx"; - }; + environment = mkMerge [{ + variables = { + GTK_IM_MODULE = "fcitx"; + QT_IM_MODULE = "fcitx"; + XMODIFIERS = "@im=fcitx"; + }; + } + (mkIf whetherRimeDataDir { + pathsToLink = [ + "/share/rime-data" + ]; + + variables = { + NIX_RIME_DATA_DIR = "/run/current-system/sw/share/rime-data"; + }; + })]; }; } |