{ lib, myNurPkgs, pkgs, ... }: let # flypy (小鹤音形) rime data from nur-ryan4yin (`pkgs/rime-data-flypy`). The # package stays pristine; personal preferences live in flypy.custom.yaml. rime-data-flypy = myNurPkgs.rime-data-flypy; # Personal Rime customisation, layered by Rime on top of the shared rime-data. custom = ./flypy.custom.yaml; # Manually maintained user dictionary (custom phrases, symbols, missing # characters); Rime reads it from the user directory. user-dict = ./flypy_user.txt; in lib.mkMerge [ # Linux: fcitx5-rime, with its user directory in ~/.local/share/fcitx5/rime. (lib.mkIf pkgs.stdenv.hostPlatform.isLinux { # Chinese: flypy (小鹤音形) data instead of the default rime-data. i18n.inputMethod.fcitx5.addons = [ (pkgs.fcitx5-rime.override { rimeDataPkgs = [ rime-data-flypy ]; }) ]; xdg.dataFile."fcitx5/rime/flypy.custom.yaml".source = custom; xdg.dataFile."fcitx5/rime/flypy_user.txt".source = user-dict; }) # macOS: Squirrel reads shared data from ~/Library/Rime, so link the data there. # Its `flypy_user.txt` template overlaps our dictionary, so the regular files # below must win. This is the only recursive link in the configuration. (lib.mkIf pkgs.stdenv.hostPlatform.isDarwin { home.fileOverlapResolution = "override"; home.file."Library/Rime" = { source = "${rime-data-flypy}/share/rime-data"; recursive = true; # overwrite possible existing data dynamically generated by squirrel force = true; }; home.file."Library/Rime/flypy.custom.yaml".source = custom; home.file."Library/Rime/flypy_user.txt".source = user-dict; }) ]