push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,192 @@
# Input Methods {#module-services-input-methods}
Input methods are an operating system component that allows any data, such as
keyboard strokes or mouse movements, to be received as input. In this way
users can enter characters and symbols not found on their input devices.
Using an input method is obligatory for any language that has more graphemes
than there are keys on the keyboard.
The following input methods are available in NixOS:
- IBus: The intelligent input bus.
- 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.
- Uim: The universal input method, is a library with a XIM bridge.
- Hime: An extremely easy-to-use input method framework.
- Kime: Korean IME
## IBus {#module-services-input-methods-ibus}
IBus is an Intelligent Input Bus. It provides full featured and user
friendly input method user interface.
The following snippet can be used to configure IBus:
```nix
{
i18n.inputMethod = {
enable = true;
type = "ibus";
ibus.engines = with pkgs.ibus-engines; [
anthy
hangul
mozc
];
};
}
```
`i18n.inputMethod.ibus.engines` is optional and can be used
to add extra IBus engines.
Available extra IBus engines are:
- Anthy (`ibus-engines.anthy`): Anthy is a system for
Japanese input method. It converts Hiragana text to Kana Kanji mixed text.
- Hangul (`ibus-engines.hangul`): Korean input method.
- libpinyin (`ibus-engines.libpinyin`): A Chinese input method.
- m17n (`ibus-engines.m17n`): m17n is an input method that
uses input methods and corresponding icons in the m17n database.
- mozc (`ibus-engines.mozc`): A Japanese input method from
Google.
- Table (`ibus-engines.table`): An input method that load
tables of input methods.
- table-others (`ibus-engines.table-others`): Various
table-based input methods. To use this, and any other table-based input
methods, it must appear in the list of engines along with
`table`. For example:
```nix
{
ibus.engines = with pkgs.ibus-engines; [
table
table-others
];
}
```
To use any input method, the package must be added in the configuration, as
shown above, and also (after running `nixos-rebuild`) the
input method must be added from IBus' preference dialog.
### Troubleshooting {#module-services-input-methods-troubleshooting}
If IBus works in some applications but not others, a likely cause of this
is that IBus is depending on a different version of `glib`
to what the applications are depending on. This can be checked by running
`nix-store -q --requisites <path> | grep glib`,
where `<path>` is the path of either IBus or an
application in the Nix store. The `glib` packages must
match exactly. If they do not, uninstalling and reinstalling the
application is a likely fix.
## Fcitx5 {#module-services-input-methods-fcitx}
Fcitx5 is an input method framework with extension support. It has three
built-in Input Method Engine, Pinyin, QuWei and Table-based input methods.
The following snippet can be used to configure Fcitx:
```nix
{
i18n.inputMethod = {
enable = true;
type = "fcitx5";
fcitx5.addons = with pkgs; [
fcitx5-mozc
fcitx5-hangul
fcitx5-m17n
];
};
}
```
`i18n.inputMethod.fcitx5.addons` is optional and can be
used to add extra Fcitx5 addons.
Available extra Fcitx5 addons are:
- Anthy (`fcitx5-anthy`): Anthy is a system for
Japanese input method. It converts Hiragana text to Kana Kanji mixed text.
- Chewing (`fcitx5-chewing`): Chewing is an
intelligent Zhuyin input method. It is one of the most popular input
methods among Traditional Chinese Unix users.
- Hangul (`fcitx5-hangul`): Korean input method.
- Unikey (`fcitx5-unikey`): Vietnamese input method.
- m17n (`fcitx5-m17n`): m17n is an input method that
uses input methods and corresponding icons in the m17n database.
- mozc (`fcitx5-mozc`): A Japanese input method from
Google.
- table-others (`fcitx5-table-other`): Various
table-based input methods.
- chinese-addons (`fcitx5-chinese-addons`): Various chinese input methods.
- rime (`fcitx5-rime`): RIME support for fcitx5.
## Nabi {#module-services-input-methods-nabi}
Nabi is an easy to use Korean X input method. It allows you to enter
phonetic Korean characters (hangul) and pictographic Korean characters
(hanja).
The following snippet can be used to configure Nabi:
```nix
{
i18n.inputMethod = {
enable = true;
type = "nabi";
};
}
```
## Uim {#module-services-input-methods-uim}
Uim (short for "universal input method") is a multilingual input method
framework. Applications can use it through so-called bridges.
The following snippet can be used to configure uim:
```nix
{
i18n.inputMethod = {
enable = true;
type = "uim";
};
}
```
Note: The [](#opt-i18n.inputMethod.uim.toolbar) option can be
used to choose uim toolbar.
## Hime {#module-services-input-methods-hime}
Hime is an extremely easy-to-use input method framework. It is lightweight,
stable, powerful and supports many commonly used input methods, including
Cangjie, Zhuyin, Dayi, Rank, Shrimp, Greek, Korean Pinyin, Latin Alphabet,
etc...
The following snippet can be used to configure Hime:
```nix
{
i18n.inputMethod = {
enable = true;
type = "hime";
};
}
```
## Kime {#module-services-input-methods-kime}
Kime is Korean IME. it's built with Rust language and let you get simple, safe, fast Korean typing
The following snippet can be used to configure Kime:
```nix
{
i18n.inputMethod = {
enable = true;
type = "kime";
};
}
```

View File

@@ -0,0 +1,121 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.i18n.inputMethod;
allowedTypes = lib.types.enum [
"ibus"
"fcitx5"
"nabi"
"uim"
"hime"
"kime"
];
gtk2_cache =
pkgs.runCommand "gtk2-immodule.cache"
{
preferLocalBuild = true;
allowSubstitutes = false;
buildInputs = [
cfg.package
];
}
''
mkdir -p $out/etc/gtk-2.0/
GTK_PATH=${cfg.package}/lib/gtk-2.0/ ${pkgs.stdenv.hostPlatform.emulator pkgs.buildPackages} ${lib.getExe' pkgs.gtk2.dev "gtk-query-immodules-2.0"} > $out/etc/gtk-2.0/immodules.cache
'';
gtk3_cache =
pkgs.runCommand "gtk3-immodule.cache"
{
preferLocalBuild = true;
allowSubstitutes = false;
buildInputs = [
cfg.package
];
}
''
mkdir -p $out/etc/gtk-3.0/
GTK_PATH=${cfg.package}/lib/gtk-3.0/ ${pkgs.stdenv.hostPlatform.emulator pkgs.buildPackages} ${lib.getExe' pkgs.gtk3.dev "gtk-query-immodules-3.0"} > $out/etc/gtk-3.0/immodules.cache
'';
in
{
options.i18n = {
inputMethod = {
enable = lib.mkEnableOption "an additional input method type" // {
default = cfg.enabled != null;
defaultText = lib.literalMD "`true` if the deprecated option `enabled` is set, false otherwise";
};
enabled = lib.mkOption {
type = lib.types.nullOr allowedTypes;
default = null;
example = "fcitx5";
description = "Deprecated - use `type` and `enable = true` instead";
};
type = lib.mkOption {
type = lib.types.nullOr allowedTypes;
default = cfg.enabled;
defaultText = lib.literalMD "The value of the deprecated option `enabled`, defaulting to null";
example = "fcitx5";
description = ''
Select the enabled input method. Input methods is a software to input symbols that are not available on standard input devices.
Input methods are specially used to input Chinese, Japanese and Korean characters.
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`.
- 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.
- hime: An extremely easy-to-use input method framework.
- kime: Koream IME.
'';
};
package = lib.mkOption {
internal = true;
type = lib.types.nullOr lib.types.path;
default = null;
description = ''
The input method method package.
'';
};
enableGtk2 = lib.mkEnableOption "Gtk2 support";
enableGtk3 = lib.mkEnableOption "Gtk3 support" // {
default = true;
};
};
};
config = lib.mkIf cfg.enable {
warnings =
lib.optional (cfg.enabled != null)
"i18n.inputMethod.enabled will be removed in a future release. Please use .type, and .enable = true instead";
environment.systemPackages = [
cfg.package
]
++ lib.optional (
cfg.enableGtk2 && (pkgs.stdenv.hostPlatform.emulatorAvailable pkgs.buildPackages)
) gtk2_cache
++ lib.optional (
cfg.enableGtk3 && (pkgs.stdenv.hostPlatform.emulatorAvailable pkgs.buildPackages)
) gtk3_cache;
};
meta = {
maintainers = [ ];
doc = ./default.md;
};
}

View File

@@ -0,0 +1,153 @@
{
config,
pkgs,
lib,
...
}:
let
imcfg = config.i18n.inputMethod;
cfg = imcfg.fcitx5;
fcitx5Package = pkgs.qt6Packages.fcitx5-with-addons.override { inherit (cfg) addons; };
settingsFormat = pkgs.formats.ini { };
in
{
options = {
i18n.inputMethod.fcitx5 = {
addons = lib.mkOption {
type = with lib.types; listOf package;
default = [ ];
example = lib.literalExpression "with pkgs; [ fcitx5-rime ]";
description = ''
Enabled Fcitx5 addons.
'';
};
waylandFrontend = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Use the Wayland input method frontend.
See [Using Fcitx 5 on Wayland](https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland).
'';
};
quickPhrase = lib.mkOption {
type = with lib.types; attrsOf str;
default = { };
example = lib.literalExpression ''
{
smile = "";
angry = "()";
}
'';
description = "Quick phrases.";
};
quickPhraseFiles = lib.mkOption {
type = with lib.types; attrsOf path;
default = { };
example = lib.literalExpression ''
{
words = ./words.mb;
numbers = ./numbers.mb;
}
'';
description = "Quick phrase files.";
};
settings = {
globalOptions = lib.mkOption {
type = lib.types.submodule {
freeformType = settingsFormat.type;
};
default = { };
description = ''
The global options in `config` file in ini format.
'';
};
inputMethod = lib.mkOption {
type = lib.types.submodule {
freeformType = settingsFormat.type;
};
default = { };
description = ''
The input method configure in `profile` file in ini format.
'';
};
addons = lib.mkOption {
type = with lib.types; (attrsOf anything);
default = { };
description = ''
The addon configures in `conf` folder in ini format with global sections.
Each item is written to the corresponding file.
'';
example = lib.literalExpression "{ pinyin.globalSection.EmojiEnabled = \"True\"; }";
};
};
ignoreUserConfig = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Ignore the user configures. **Warning**: When this is enabled, the
user config files are totally ignored and the user dict can't be saved
and loaded.
'';
};
};
};
imports = [
(lib.mkRemovedOptionModule [ "i18n" "inputMethod" "fcitx5" "enableRimeData" ] ''
RIME data is now included in `fcitx5-rime` by default, and can be customized using `fcitx5-rime.override { rimeDataPkgs = ...; }`
'')
(lib.mkRemovedOptionModule [ "i18n" "inputMethod" "fcitx5" "plasma6Support" ] ''
qt6 is the only one used for fcitx5-configtool now.
'')
];
config = lib.mkIf (imcfg.enable && imcfg.type == "fcitx5") {
i18n.inputMethod.package = fcitx5Package;
i18n.inputMethod.fcitx5.addons =
lib.optionals (cfg.quickPhrase != { }) [
(pkgs.writeTextDir "share/fcitx5/data/QuickPhrase.mb" (
lib.concatStringsSep "\n" (
lib.mapAttrsToList (
name: value: "${name} ${builtins.replaceStrings [ "\\" "\n" ] [ "\\\\" "\\n" ] value}"
) cfg.quickPhrase
)
))
]
++ lib.optionals (cfg.quickPhraseFiles != { }) [
(pkgs.linkFarm "quickPhraseFiles" (
lib.mapAttrs' (
name: value: lib.nameValuePair "share/fcitx5/data/quickphrase.d/${name}.mb" value
) cfg.quickPhraseFiles
))
];
environment.etc =
let
optionalFile =
p: f: v:
lib.optionalAttrs (v != { }) {
"xdg/fcitx5/${p}".text = f v;
};
in
lib.attrsets.mergeAttrsList [
(optionalFile "config" (lib.generators.toINI { }) cfg.settings.globalOptions)
(optionalFile "profile" (lib.generators.toINI { }) cfg.settings.inputMethod)
(lib.concatMapAttrs (
name: value: optionalFile "conf/${name}.conf" (lib.generators.toINIWithGlobalSection { }) value
) cfg.settings.addons)
];
environment.variables = {
XMODIFIERS = "@im=fcitx";
QT_PLUGIN_PATH = [ "${fcitx5Package}/${pkgs.qt6.qtbase.qtPluginPrefix}" ];
}
// lib.optionalAttrs (!cfg.waylandFrontend) {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
};
environment.sessionVariables = lib.mkIf cfg.ignoreUserConfig {
SKIP_FCITX_USER_PATH = "1";
};
};
}

View File

@@ -0,0 +1,20 @@
{
config,
pkgs,
lib,
...
}:
let
imcfg = config.i18n.inputMethod;
in
{
config = lib.mkIf (imcfg.enable && imcfg.type == "hime") {
i18n.inputMethod.package = pkgs.hime;
environment.variables = {
GTK_IM_MODULE = "hime";
QT_IM_MODULE = "hime";
XMODIFIERS = "@im=hime";
};
services.xserver.displayManager.sessionCommands = "${pkgs.hime}/bin/hime &";
};
}

View File

@@ -0,0 +1,91 @@
{
config,
pkgs,
lib,
...
}:
let
imcfg = config.i18n.inputMethod;
cfg = imcfg.ibus;
ibusPackage = pkgs.ibus-with-plugins.override { plugins = cfg.engines; };
ibusEngine = lib.types.mkOptionType {
name = "ibus-engine";
inherit (lib.types.package) descriptionClass merge;
check = x: (lib.types.package.check x) && (lib.attrByPath [ "meta" "isIbusEngine" ] false x);
};
impanel = lib.optionalString (cfg.panel != null) "--panel=${cfg.panel}";
ibusAutostart = pkgs.writeTextFile {
name = "autostart-ibus-daemon";
destination = "/etc/xdg/autostart/ibus-daemon.desktop";
text = ''
[Desktop Entry]
Name=IBus
Type=Application
Exec=${ibusPackage}/bin/ibus-daemon --daemonize --xim ${impanel}
# GNOME will launch ibus using systemd
NotShowIn=GNOME;
'';
};
in
{
imports = [
(lib.mkRenamedOptionModule
[ "programs" "ibus" "plugins" ]
[ "i18n" "inputMethod" "ibus" "engines" ]
)
];
options = {
i18n.inputMethod.ibus = {
engines = lib.mkOption {
type = with lib.types; listOf ibusEngine;
default = [ ];
example = lib.literalExpression "with pkgs.ibus-engines; [ mozc hangul ]";
description =
let
enginesDrv = lib.filterAttrs (lib.const lib.isDerivation) pkgs.ibus-engines;
engines = lib.concatStringsSep ", " (map (name: "`${name}`") (lib.attrNames enginesDrv));
in
"Enabled IBus engines. Available engines are: ${engines}.";
};
panel = lib.mkOption {
type = with lib.types; nullOr path;
default = null;
example = lib.literalExpression ''"''${pkgs.kdePackages.plasma-desktop}/libexec/kimpanel-ibus-panel"'';
description = "Replace the IBus panel with another panel.";
};
};
};
config = lib.mkIf (imcfg.enable && imcfg.type == "ibus") {
i18n.inputMethod.package = ibusPackage;
environment.systemPackages = [
ibusAutostart
];
# Without dconf enabled it is impossible to use IBus
programs.dconf.enable = true;
programs.dconf.packages = [ ibusPackage ];
services.dbus.packages = [
ibusPackage
];
environment.variables = {
GTK_IM_MODULE = "ibus";
QT_IM_MODULE = "ibus";
XMODIFIERS = "@im=ibus";
};
xdg.portal.extraPortals = lib.mkIf config.xdg.portal.enable [
ibusPackage
];
};
# uses attributes of the linked package
meta.buildDocsInSandbox = false;
}

View File

@@ -0,0 +1,83 @@
{
config,
pkgs,
lib,
generators,
...
}:
let
imcfg = config.i18n.inputMethod;
in
{
imports = [
(lib.mkRemovedOptionModule [
"i18n"
"inputMethod"
"kime"
"config"
] "Use i18n.inputMethod.kime.* instead")
];
options.i18n.inputMethod.kime = {
daemonModules = lib.mkOption {
type = lib.types.listOf (
lib.types.enum [
"Xim"
"Wayland"
"Indicator"
]
);
default = [
"Xim"
"Wayland"
"Indicator"
];
example = [
"Xim"
"Indicator"
];
description = ''
List of enabled daemon modules
'';
};
iconColor = lib.mkOption {
type = lib.types.enum [
"Black"
"White"
];
default = "Black";
example = "White";
description = ''
Color of the indicator icon
'';
};
extraConfig = lib.mkOption {
type = lib.types.lines;
default = "";
description = ''
extra kime configuration. Refer to <https://github.com/Riey/kime/blob/v${pkgs.kime.version}/docs/CONFIGURATION.md> for details on supported values.
'';
};
};
config = lib.mkIf (imcfg.enable && imcfg.type == "kime") {
i18n.inputMethod.package = pkgs.kime;
environment.variables = {
GTK_IM_MODULE = "kime";
QT_IM_MODULE = "kime";
XMODIFIERS = "@im=kime";
};
environment.etc."xdg/kime/config.yaml".text = ''
daemon:
modules: [${lib.concatStringsSep "," imcfg.kime.daemonModules}]
indicator:
icon_color: ${imcfg.kime.iconColor}
''
+ imcfg.kime.extraConfig;
};
# uses attributes of the linked package
meta.buildDocsInSandbox = false;
}

View File

@@ -0,0 +1,22 @@
{
config,
pkgs,
lib,
...
}:
let
imcfg = config.i18n.inputMethod;
in
{
config = lib.mkIf (imcfg.enable && imcfg.type == "nabi") {
i18n.inputMethod.package = pkgs.nabi;
environment.variables = {
GTK_IM_MODULE = "nabi";
QT_IM_MODULE = "nabi";
XMODIFIERS = "@im=nabi";
};
services.xserver.displayManager.sessionCommands = "${pkgs.nabi}/bin/nabi &";
};
}

View File

@@ -0,0 +1,46 @@
{
config,
pkgs,
lib,
...
}:
let
imcfg = config.i18n.inputMethod;
cfg = imcfg.uim;
in
{
options = {
i18n.inputMethod.uim = {
toolbar = lib.mkOption {
type = lib.types.enum [
"gtk"
"gtk3"
"gtk-systray"
"gtk3-systray"
"qt5"
];
default = "gtk";
example = "gtk-systray";
description = ''
selected UIM toolbar.
'';
};
};
};
config = lib.mkIf (imcfg.enable && imcfg.type == "uim") {
i18n.inputMethod.package = pkgs.uim;
environment.variables = {
GTK_IM_MODULE = "uim";
QT_IM_MODULE = "uim";
XMODIFIERS = "@im=uim";
};
services.xserver.displayManager.sessionCommands = ''
${pkgs.uim}/bin/uim-xim &
${pkgs.uim}/bin/uim-toolbar-${cfg.toolbar} &
'';
};
}