im/fcitx: drop as fcitx 4 has been removed from nixpkgs (#3804)

Reference: https://github.com/NixOS/nixpkgs/pull/220776
This commit is contained in:
Nick Cao 2023-03-25 22:32:31 +08:00 committed by GitHub
parent 885a504f80
commit 3ace6a31dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 61 deletions

View file

@ -22,8 +22,7 @@ let
''; '';
in { in {
imports = imports = [ ./fcitx5.nix ./hime.nix ./kime.nix ./nabi.nix ./uim.nix ];
[ ./fcitx.nix ./fcitx5.nix ./hime.nix ./kime.nix ./nabi.nix ./uim.nix ];
options.i18n = { options.i18n = {
inputMethod = { inputMethod = {
@ -31,7 +30,7 @@ in {
type = types.nullOr type = types.nullOr
(types.enum [ "fcitx" "fcitx5" "nabi" "uim" "hime" "kime" ]); (types.enum [ "fcitx" "fcitx5" "nabi" "uim" "hime" "kime" ]);
default = null; default = null;
example = "fcitx"; example = "fcitx5";
description = '' description = ''
Select the enabled input method. Input methods is a software to input Select the enabled input method. Input methods is a software to input
symbols that are not available on standard input devices. symbols that are not available on standard input devices.
@ -42,17 +41,10 @@ in {
Currently the following input methods are available in Home Manager: Currently the following input methods are available in Home Manager:
<variablelist> <variablelist>
<varlistentry>
<term><literal>fcitx</literal></term>
<listitem><para>
A customizable lightweight input method
extra input engines can be added using
<literal>i18n.inputMethod.fcitx.engines</literal>.
</para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><literal>fcitx5</literal></term> <term><literal>fcitx5</literal></term>
<listitem><para> <listitem><para>
A customizable lightweight input method.
The next generation of fcitx, The next generation of fcitx,
addons (including engines, dictionaries, skins) can be added using addons (including engines, dictionaries, skins) can be added using
<literal>i18n.inputMethod.fcitx5.addons</literal>. <literal>i18n.inputMethod.fcitx5.addons</literal>.
@ -97,6 +89,10 @@ in {
config = mkIf (cfg.enabled != null) { config = mkIf (cfg.enabled != null) {
assertions = [ assertions = [
(hm.assertions.assertPlatform "i18n.inputMethod" pkgs platforms.linux) (hm.assertions.assertPlatform "i18n.inputMethod" pkgs platforms.linux)
{
assertion = cfg.enabled != "fcitx";
message = "fcitx has been removed, please use fcitx5 instead";
}
]; ];
home.packages = [ cfg.package gtk2Cache gtk3Cache ]; home.packages = [ cfg.package gtk2Cache gtk3Cache ];

View file

@ -1,50 +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:
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: "<literal>${name}</literal>") (attrNames enginesDrv));
in "Enabled Fcitx engines. Available engines are: ${engines}.";
};
};
};
config = mkIf (config.i18n.inputMethod.enabled == "fcitx") {
i18n.inputMethod.package = fcitxPackage;
home.sessionVariables = {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
};
systemd.user.services.fcitx-daemon = {
Unit = {
Description = "Fcitx input method editor";
PartOf = [ "graphical-session.desktop" ];
};
Service.ExecStart = "${fcitxPackage}/bin/fcitx";
Install.WantedBy = [ "graphical-session.target" ];
};
};
}