1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
{
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
pkgs.gtk2
];
disallowedReferences = [
(lib.getDev pkgs.gtk2)
];
}
''
mkdir -p $out/etc/gtk-2.0/
GTK_PATH=${cfg.package}/lib/gtk-2.0/ ${pkgs.stdenv.hostPlatform.emulator pkgs.buildPackages} 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
pkgs.gtk3
];
disallowedReferences = [
(lib.getDev pkgs.gtk3)
];
}
''
mkdir -p $out/etc/gtk-3.0/
GTK_PATH=${cfg.package}/lib/gtk-3.0/ ${pkgs.stdenv.hostPlatform.emulator pkgs.buildPackages} 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;
};
}
|