ibus service: refactoring

This commit is contained in:
Eric Sagnes 2016-02-10 16:10:35 +09:00
parent 7ec5dc9234
commit 52dd53373f
9 changed files with 87 additions and 77 deletions

View File

@ -0,0 +1,52 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.i18n.inputMethod.ibus;
ibusPackage = pkgs.ibus-with-plugins.override { plugins = cfg.engines; };
ibusEngine = types.package // {
name = "ibus-engine";
check = x: (lib.types.package.check x) && (attrByPath ["meta" "isIbusEngine"] false x);
};
in
{
options = {
i18n.inputMethod.ibus = {
enable = mkOption {
type = types.bool;
default = false;
example = true;
description = ''
Enable IBus input method.
IBus can be used input of Chinese, Korean, Japanese and other special characters.
'';
};
engines = mkOption {
type = with types; listOf ibusEngine;
default = [];
example = literalExample "with pkgs.ibus-engines; [ mozc hangul ]";
description = ''
Enabled IBus engines.
Available engines can be found by running `nix-env "<nixpkgs>" . -qaP -A ibus-engines`.
'';
};
};
};
config = mkIf cfg.enable {
# Without dconf enabled it is impossible to use IBus
environment.systemPackages = [ ibusPackage pkgs.gnome3.dconf ];
gtkPlugins = [ pkgs.ibus ];
qtPlugins = [ pkgs.ibus-qt ];
environment.variables = {
GTK_IM_MODULE = "ibus";
QT_IM_MODULE = "ibus";
XMODIFIERS = "@im=ibus";
};
services.xserver.displayManager.sessionCommands = "${ibusPackage}/bin/ibus-daemon --daemonize --xim --cache=none";
};
}

View File

@ -44,6 +44,7 @@
./hardware/video/ati.nix ./hardware/video/ati.nix
./hardware/video/webcam/facetimehd.nix ./hardware/video/webcam/facetimehd.nix
./i18n/inputMethod/fcitx.nix ./i18n/inputMethod/fcitx.nix
./i18n/inputMethod/ibus.nix
./installer/tools/auto-upgrade.nix ./installer/tools/auto-upgrade.nix
./installer/tools/nixos-checkout.nix ./installer/tools/nixos-checkout.nix
./installer/tools/tools.nix ./installer/tools/tools.nix
@ -67,7 +68,6 @@
./programs/environment.nix ./programs/environment.nix
./programs/freetds.nix ./programs/freetds.nix
./programs/fish.nix ./programs/fish.nix
./programs/ibus.nix
./programs/kbdlight.nix ./programs/kbdlight.nix
./programs/light.nix ./programs/light.nix
./programs/man.nix ./programs/man.nix

View File

@ -1,51 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.programs.ibus;
in
{
options = {
programs.ibus = {
enable = mkOption {
type = types.bool;
default = false;
example = true;
description = "Enable IBus input method";
};
plugins = mkOption {
type = lib.types.listOf lib.types.path;
default = [];
description = ''
IBus plugin packages
'';
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.ibus pkgs.gnome3.dconf ];
gtkPlugins = [ pkgs.ibus ];
qtPlugins = [ pkgs.ibus-qt ];
environment.variables =
let
env = pkgs.buildEnv {
name = "ibus-env";
paths = [ pkgs.ibus ] ++ cfg.plugins;
};
in {
GTK_IM_MODULE = "ibus";
QT_IM_MODULE = "ibus";
XMODIFIERS = "@im=ibus";
IBUS_COMPONENT_PATH = "${env}/share/ibus/component";
};
services.xserver.displayManager.sessionCommands = "${pkgs.ibus}/bin/ibus-daemon --daemonize --xim --cache=none";
};
}

View File

@ -59,6 +59,10 @@ with lib;
# Tarsnap # Tarsnap
(mkRenamedOptionModule [ "services" "tarsnap" "config" ] [ "services" "tarsnap" "archives" ]) (mkRenamedOptionModule [ "services" "tarsnap" "config" ] [ "services" "tarsnap" "archives" ])
# ibus
(mkRenamedOptionModule [ "programs" "ibus" "enable" ] [ "i18n" "inputMethod" "ibus" "enable" ])
(mkRenamedOptionModule [ "programs" "ibus" "plugins" ] [ "i18n" "inputMethod" "ibus" "engines" ])
# proxy # proxy
(mkRenamedOptionModule [ "nix" "proxy" ] [ "networking" "proxy" "default" ]) (mkRenamedOptionModule [ "nix" "proxy" ] [ "networking" "proxy" "default" ])

View File

@ -6,11 +6,12 @@ stdenv.mkDerivation rec {
version = "1.5.8"; version = "1.5.8";
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "IBus interface to the anthy input method"; isIbusEngine = true;
homepage = http://wiki.github.com/fujiwarat/ibus-anthy; description = "IBus interface to the anthy input method";
license = licenses.gpl2Plus; homepage = http://wiki.github.com/fujiwarat/ibus-anthy;
platforms = platforms.linux; license = licenses.gpl2Plus;
maintainers = with maintainers; [ gebner ericsagnes ]; platforms = platforms.linux;
maintainers = with maintainers; [ gebner ericsagnes ];
}; };
preConfigure = "./autogen.sh --prefix=$out"; preConfigure = "./autogen.sh --prefix=$out";

View File

@ -29,10 +29,11 @@ stdenv.mkDerivation rec {
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Ibus Hangul engine."; isIbusEngine = true;
homepage = https://github.com/choehwanjin/ibus-hangul; description = "Ibus Hangul engine.";
license = licenses.gpl2; homepage = https://github.com/choehwanjin/ibus-hangul;
platforms = platforms.linux; license = licenses.gpl2;
maintainers = with maintainers; [ ericsagnes ]; platforms = platforms.linux;
maintainers = with maintainers; [ ericsagnes ];
}; };
} }

View File

@ -11,11 +11,12 @@ in clangStdenv.mkDerivation rec {
version = "2.17.2313.102"; version = "2.17.2313.102";
meta = with clangStdenv.lib; { meta = with clangStdenv.lib; {
description = "Japanese input method from Google"; isIbusEngine = true;
homepage = http://code.google.com/p/mozc/; description = "Japanese input method from Google";
license = licenses.free; homepage = http://code.google.com/p/mozc/;
platforms = platforms.linux; license = licenses.free;
maintainers = with maintainers; [ gebner ericsagnes ]; platforms = platforms.linux;
maintainers = with maintainers; [ gebner ericsagnes ];
}; };
nativeBuildInputs = [ gyp which ninja python pkgconfig ]; nativeBuildInputs = [ gyp which ninja python pkgconfig ];

View File

@ -20,10 +20,11 @@ stdenv.mkDerivation rec {
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Various table-based input methods for IBus"; isIbusEngine = true;
homepage = https://github.com/moebiuscurve/ibus-table-others; description = "Various table-based input methods for IBus";
license = licenses.gpl3; homepage = https://github.com/moebiuscurve/ibus-table-others;
platforms = platforms.linux; license = licenses.gpl3;
maintainers = with maintainers; [ mudri ]; platforms = platforms.linux;
maintainers = with maintainers; [ mudri ];
}; };
} }

View File

@ -12,10 +12,11 @@ stdenv.mkDerivation rec {
buildInputs = [ ibus pkgconfig python3 pythonPackages.pygobject3 ]; buildInputs = [ ibus pkgconfig python3 pythonPackages.pygobject3 ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "An IBus framework for table-based input methods"; isIbusEngine = true;
homepage = https://github.com/kaio/ibus-table/wiki; description = "An IBus framework for table-based input methods";
license = licenses.lgpl21; homepage = https://github.com/kaio/ibus-table/wiki;
platforms = platforms.linux; license = licenses.lgpl21;
maintainers = with maintainers; [ mudri ]; platforms = platforms.linux;
maintainers = with maintainers; [ mudri ];
}; };
} }