From 051b74fe7d7398c24fee4d703bd1e32a88b68393 Mon Sep 17 00:00:00 2001 From: Vonfry Date: Sun, 12 Mar 2023 12:03:50 +0800 Subject: [PATCH] nixos/fcitx: deprecated, and suggestions to use fcitx5 instead --- .../manual/release-notes/rl-2305.section.md | 2 + nixos/modules/i18n/input-method/default.nix | 5 +- nixos/modules/i18n/input-method/fcitx.nix | 46 ------ nixos/modules/module-list.nix | 1 - nixos/modules/rename.nix | 2 + nixos/tests/all-tests.nix | 1 - nixos/tests/fcitx/config | 12 -- nixos/tests/fcitx/default.nix | 142 ------------------ nixos/tests/fcitx/profile | 4 - 9 files changed, 6 insertions(+), 209 deletions(-) delete mode 100644 nixos/modules/i18n/input-method/fcitx.nix delete mode 100644 nixos/tests/fcitx/config delete mode 100644 nixos/tests/fcitx/default.nix delete mode 100644 nixos/tests/fcitx/profile diff --git a/nixos/doc/manual/release-notes/rl-2305.section.md b/nixos/doc/manual/release-notes/rl-2305.section.md index 996dcea58adb..9c291276a344 100644 --- a/nixos/doc/manual/release-notes/rl-2305.section.md +++ b/nixos/doc/manual/release-notes/rl-2305.section.md @@ -132,6 +132,8 @@ In addition to numerous new and upgraded packages, this release has the followin - Nebula now runs as a system user and group created for each nebula network, using the `CAP_NET_ADMIN` ambient capability on launch rather than starting as root. Ensure that any files each Nebula instance needs to access are owned by the correct user and group, by default `nebula-${networkName}`. +- The `i18n.inputMethod.fcitx` option has been replaced with `i18n.inputMethod.fcitx5` because fcitx 4 `pkgs.fcitx` has been removed. + - In `mastodon` it is now necessary to specify location of file with `PostgreSQL` database password. In `services.mastodon.database.passwordFile` parameter default value `/var/lib/mastodon/secrets/db-password` has been changed to `null`. - The `--target-host` and `--build-host` options of `nixos-rebuild` no longer treat the `localhost` value specially – to build on/deploy to local machine, omit the relevant flag. diff --git a/nixos/modules/i18n/input-method/default.nix b/nixos/modules/i18n/input-method/default.nix index 5f803b4f2ee7..d967d4335c70 100644 --- a/nixos/modules/i18n/input-method/default.nix +++ b/nixos/modules/i18n/input-method/default.nix @@ -29,9 +29,9 @@ in options.i18n = { inputMethod = { enabled = mkOption { - type = types.nullOr (types.enum [ "ibus" "fcitx" "fcitx5" "nabi" "uim" "hime" "kime" ]); + type = types.nullOr (types.enum [ "ibus" "fcitx5" "nabi" "uim" "hime" "kime" ]); default = null; - example = "fcitx"; + example = "fcitx5"; description = lib.mdDoc '' Select the enabled input method. Input methods is a software to input symbols that are not available on standard input devices. @@ -40,7 +40,6 @@ in Currently the following input methods are available in NixOS: - ibus: The intelligent input bus, extra input engines can be added using `i18n.inputMethod.ibus.engines`. - - fcitx: A customizable lightweight input method, extra input engines can be added using `i18n.inputMethod.fcitx.engines`. - fcitx5: The next generation of fcitx, addons (including engines, dictionaries, skins) can be added using `i18n.inputMethod.fcitx5.addons`. - nabi: A Korean input method based on XIM. Nabi doesn't support Qt 5. - uim: The universal input method, is a library with a XIM bridge. uim mainly support Chinese, Japanese and Korean. diff --git a/nixos/modules/i18n/input-method/fcitx.nix b/nixos/modules/i18n/input-method/fcitx.nix deleted file mode 100644 index 043ec3d55c1f..000000000000 --- a/nixos/modules/i18n/input-method/fcitx.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ config, pkgs, lib, ... }: - -with lib; - -let - cfg = config.i18n.inputMethod.fcitx; - fcitxPackage = pkgs.fcitx.override { plugins = cfg.engines; }; - fcitxEngine = types.package // { - name = "fcitx-engine"; - check = x: (lib.types.package.check x) && (attrByPath ["meta" "isFcitxEngine"] false x); - }; -in -{ - options = { - - i18n.inputMethod.fcitx = { - engines = mkOption { - type = with types; listOf fcitxEngine; - default = []; - example = literalExpression "with pkgs.fcitx-engines; [ mozc hangul ]"; - description = - let - enginesDrv = filterAttrs (const isDerivation) pkgs.fcitx-engines; - engines = concatStringsSep ", " - (map (name: "`${name}`") (attrNames enginesDrv)); - in - lib.mdDoc "Enabled Fcitx engines. Available engines are: ${engines}."; - }; - }; - - }; - - config = mkIf (config.i18n.inputMethod.enabled == "fcitx") { - i18n.inputMethod.package = fcitxPackage; - - environment.variables = { - GTK_IM_MODULE = "fcitx"; - QT_IM_MODULE = "fcitx"; - XMODIFIERS = "@im=fcitx"; - }; - services.xserver.displayManager.sessionCommands = "${fcitxPackage}/bin/fcitx"; - }; - - # uses attributes of the linked package - meta.buildDocsInSandbox = false; -} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 69fb14a1fef4..7b5a1759d3c5 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -104,7 +104,6 @@ ./hardware/xone.nix ./hardware/xpadneo.nix ./i18n/input-method/default.nix - ./i18n/input-method/fcitx.nix ./i18n/input-method/fcitx5.nix ./i18n/input-method/hime.nix ./i18n/input-method/ibus.nix diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index d8a18cfcc6dc..b8b17df9254e 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -106,6 +106,8 @@ with lib; (mkRemovedOptionModule [ "services" "riak" ] "The corresponding package was removed from nixpkgs.") (mkRemovedOptionModule [ "services" "cryptpad" ] "The corresponding package was removed from nixpkgs.") + (mkRemovedOptionModule [ "i18n" "inputMethod" "fcitx" ] "The fcitx module has been removed. Plesae use fcitx5 instead") + # Do NOT add any option renames here, see top of the file ]; } diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index ee6b65424431..7b2dce92da47 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -217,7 +217,6 @@ in { extra-python-packages = handleTest ./extra-python-packages.nix {}; evcc = handleTest ./evcc.nix {}; fancontrol = handleTest ./fancontrol.nix {}; - fcitx = handleTest ./fcitx {}; fenics = handleTest ./fenics.nix {}; ferm = handleTest ./ferm.nix {}; firefox = handleTest ./firefox.nix { firefoxPackage = pkgs.firefox; }; diff --git a/nixos/tests/fcitx/config b/nixos/tests/fcitx/config deleted file mode 100644 index 169768994e28..000000000000 --- a/nixos/tests/fcitx/config +++ /dev/null @@ -1,12 +0,0 @@ -[Hotkey] -SwitchKey=Disabled -IMSwitchHotkey=ALT_SHIFT -TimeInterval=240 - -[Program] -DelayStart=5 - -[Output] - -[Appearance] - diff --git a/nixos/tests/fcitx/default.nix b/nixos/tests/fcitx/default.nix deleted file mode 100644 index c132249fcb24..000000000000 --- a/nixos/tests/fcitx/default.nix +++ /dev/null @@ -1,142 +0,0 @@ -import ../make-test-python.nix ( - { - pkgs, ... - }: - # copy_from_host works only for store paths - rec { - name = "fcitx"; - meta.broken = true; # takes hours to time out since October 2021 - nodes.machine = - { - pkgs, - ... - }: - { - - imports = [ - ../common/user-account.nix - ]; - - environment.systemPackages = [ - # To avoid clashing with xfce4-terminal - pkgs.alacritty - ]; - - - services.xserver = - { - enable = true; - - displayManager = { - lightdm.enable = true; - autoLogin = { - enable = true; - user = "alice"; - }; - }; - - desktopManager.xfce.enable = true; - }; - - i18n = { - inputMethod = { - enabled = "fcitx"; - fcitx.engines = [ - pkgs.fcitx-engines.m17n - pkgs.fcitx-engines.table-extra - ]; - }; - }; - } - ; - - testScript = { nodes, ... }: - let - user = nodes.machine.config.users.users.alice; - userName = user.name; - userHome = user.home; - xauth = "${userHome}/.Xauthority"; - fcitx_confdir = "${userHome}/.config/fcitx"; - in - '' - # We need config files before login session - # So copy first thing - - # Point and click would be expensive, - # So configure using files - machine.copy_from_host( - "${./profile}", - "${fcitx_confdir}/profile", - ) - machine.copy_from_host( - "${./config}", - "${fcitx_confdir}/config", - ) - - start_all() - - machine.wait_for_file("${xauth}") - machine.succeed("xauth merge ${xauth}") - - machine.sleep(5) - - machine.succeed("su - ${userName} -c 'alacritty&'") - machine.succeed("su - ${userName} -c 'fcitx&'") - machine.sleep(10) - - ### Type on terminal - machine.send_chars("echo ") - machine.sleep(1) - - ### Start fcitx Unicode input - machine.send_key("ctrl-alt-shift-u") - machine.sleep(5) - machine.sleep(1) - - ### Search for smiling face - machine.send_chars("smil") - machine.sleep(1) - - ### Navigate to the second one - machine.send_key("tab") - machine.sleep(1) - - ### Choose it - machine.send_key("\n") - machine.sleep(1) - - ### Start fcitx language input - machine.send_key("ctrl-spc") - machine.sleep(1) - - ### Default zhengma, enter 一下 - machine.send_chars("a2") - machine.sleep(1) - - ### Switch to Harvard Kyoto - machine.send_key("alt-shift") - machine.sleep(1) - - ### Enter क - machine.send_chars("ka ") - machine.sleep(1) - - machine.send_key("alt-shift") - machine.sleep(1) - - ### Turn off Fcitx - machine.send_key("ctrl-spc") - machine.sleep(1) - - ### Redirect typed characters to a file - machine.send_chars(" > fcitx_test.out\n") - machine.sleep(1) - machine.screenshot("terminal_chars") - - ### Verify that file contents are as expected - file_content = machine.succeed("cat ${userHome}/fcitx_test.out") - assert file_content == "☺一下क\n" - '' - ; - } -) diff --git a/nixos/tests/fcitx/profile b/nixos/tests/fcitx/profile deleted file mode 100644 index 77497a1496bd..000000000000 --- a/nixos/tests/fcitx/profile +++ /dev/null @@ -1,4 +0,0 @@ -[Profile] -IMName=zhengma-large -EnabledIMList=fcitx-keyboard-us:True,zhengma-large:True,m17n_sa_harvard-kyoto:True -PreeditStringInClientWindow=False