summaryrefslogtreecommitdiff
path: root/modules/ibus.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2024-08-01 10:48:06 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2024-08-01 10:48:06 +0200
commit0f06a86b1eaa99ff21cdce8c5f1c54b688cbbcf6 (patch)
tree41691fef5468c5efbc32c12cbacd55e97b23b0de /modules/ibus.nix
parent48f8d3c11d9117f10e6ca5b76a08b91cef5c861b (diff)
downloadnixos-0f06a86b1eaa99ff21cdce8c5f1c54b688cbbcf6.tar
nixos-0f06a86b1eaa99ff21cdce8c5f1c54b688cbbcf6.tar.gz
nixos-0f06a86b1eaa99ff21cdce8c5f1c54b688cbbcf6.tar.bz2
nixos-0f06a86b1eaa99ff21cdce8c5f1c54b688cbbcf6.tar.xz
nixos-0f06a86b1eaa99ff21cdce8c5f1c54b688cbbcf6.zip
...
Diffstat (limited to 'modules/ibus.nix')
-rw-r--r--modules/ibus.nix79
1 files changed, 0 insertions, 79 deletions
diff --git a/modules/ibus.nix b/modules/ibus.nix
deleted file mode 100644
index bb9b3765..00000000
--- a/modules/ibus.nix
+++ /dev/null
@@ -1,79 +0,0 @@
1{ config, pkgs, lib, ... }:
2
3with lib;
4
5let
6 cfg = config.i18n.inputMethod.ibus;
7 ibusPackage = pkgs.ibus-with-plugins.override { plugins = cfg.engines; };
8 ibusEngine = types.package // {
9 name = "ibus-engine";
10 check = x: (lib.types.package.check x) && (attrByPath ["meta" "isIbusEngine"] false x);
11 };
12in
13{
14 disabledModules = [ "i18n/input-method/ibus.nix" ];
15
16 imports = [
17 (mkRenamedOptionModule [ "programs" "ibus" "plugins" ] [ "i18n" "inputMethod" "ibus" "engines" ])
18 ];
19
20 options = {
21 i18n.inputMethod.ibus = {
22 engines = mkOption {
23 type = with types; listOf ibusEngine;
24 default = [];
25 example = literalExpression "with pkgs.ibus-engines; [ mozc hangul ]";
26 description =
27 let
28 enginesDrv = filterAttrs (const isDerivation) pkgs.ibus-engines;
29 engines = concatStringsSep ", "
30 (map (name: "<literal>${name}</literal>") (attrNames enginesDrv));
31 in
32 "Enabled IBus engines. Available engines are: ${engines}.";
33 };
34 panel = mkOption {
35 type = with types; nullOr path;
36 default = null;
37 example = literalExpression ''"''${pkgs.plasma5Packages.plasma-desktop}/lib/libexec/kimpanel-ibus-panel"'';
38 description = "Replace the IBus panel with another panel.";
39 };
40 };
41 };
42
43 config = mkIf (config.i18n.inputMethod.enabled == "ibus") {
44 i18n.inputMethod.package = ibusPackage;
45
46 # Without dconf enabled it is impossible to use IBus
47 programs.dconf.enable = true;
48
49 programs.dconf.packages = [ ibusPackage ];
50
51 environment.variables = {
52 GTK_IM_MODULE = "ibus";
53 QT_IM_MODULE = "ibus";
54 XMODIFIERS = "@im=ibus";
55 };
56
57 xdg.portal.extraPortals = mkIf config.xdg.portal.enable [
58 ibusPackage
59 ];
60
61 systemd.user.services.ibus = {
62 description = "Intelligent Input Bus";
63 documentation = ["man:ibus-daemon(1)"];
64 after = ["graphical-session-pre.target"];
65 wantedBy = ["graphical-session.target"];
66
67 serviceConfig = {
68 Type = "dbus";
69 BusName = "org.freedesktop.IBus";
70 ExecStart = "${ibusPackage}/bin/ibus-daemon --xim ${optionalString (cfg.panel != null) "--panel ${cfg.panel}"}";
71 ExecReload = "${ibusPackage}/bin/ibus restart";
72 ExecStop = "${ibusPackage}/bin/ibus exit";
73 };
74 };
75 };
76
77 # uses attributes of the linked package
78 meta.buildDocsInSandbox = false;
79}