input methods: fix gtk cache

This commit is contained in:
Eric Sagnes 2016-04-04 18:11:20 +09:00
parent 3e2318ec3e
commit cfe062f2b6
6 changed files with 47 additions and 7 deletions

View File

@ -102,6 +102,8 @@ in
environment.pathsToLink = environment.pathsToLink =
[ "/bin" [ "/bin"
"/etc/xdg" "/etc/xdg"
"/etc/gtk-2.0"
"/etc/gtk-3.0"
"/info" "/info"
"/lib" # FIXME: remove and update debug-info.nix "/lib" # FIXME: remove and update debug-info.nix
"/sbin" "/sbin"

View File

@ -1,10 +1,32 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with lib; with lib;
let
cfg = config.i18n.inputMethod;
gtk2_cache = pkgs.stdenv.mkDerivation {
preferLocalBuild = true;
allowSubstitutes = false;
name = "gtk2-immodule.cache";
buildInputs = [ pkgs.gtk cfg.package ];
buildCommand = ''
mkdir -p $out/etc/gtk-2.0/
GTK_PATH=${cfg.package}/lib/gtk-2.0/ gtk-query-immodules-2.0 > $out/etc/gtk-2.0/immodules.cache
'';
};
gtk3_cache = pkgs.stdenv.mkDerivation {
preferLocalBuild = true;
allowSubstitutes = false;
name = "gtk3-immodule.cache";
buildInputs = [ pkgs.gtk3 cfg.package ];
buildCommand = ''
mkdir -p $out/etc/gtk-3.0/
GTK_PATH=${cfg.package}/lib/gtk-3.0/ gtk-query-immodules-3.0 > $out/etc/gtk-3.0/immodules.cache
'';
};
in
{ {
options = { options.i18n = {
i18n.inputMethod = { inputMethod = {
enabled = mkOption { enabled = mkOption {
type = types.nullOr (types.enum [ "ibus" "fcitx" "nabi" "uim" ]); type = types.nullOr (types.enum [ "ibus" "fcitx" "nabi" "uim" ]);
default = null; default = null;
@ -24,6 +46,20 @@ with lib;
</itemizedlist> </itemizedlist>
''; '';
}; };
package = mkOption {
internal = true;
type = types.path;
default = null;
description = ''
The input method method package.
'';
};
}; };
}; };
config = mkIf (cfg.enabled != null) {
environment.systemPackages = [ cfg.package gtk2_cache gtk3_cache ];
};
} }

View File

@ -32,7 +32,7 @@ in
}; };
config = mkIf (config.i18n.inputMethod.enabled == "fcitx") { config = mkIf (config.i18n.inputMethod.enabled == "fcitx") {
environment.systemPackages = [ fcitxPackage ]; i18n.inputMethod.package = fcitxPackage;
environment.variables = { environment.variables = {
GTK_IM_MODULE = "fcitx"; GTK_IM_MODULE = "fcitx";

View File

@ -41,9 +41,11 @@ in
}; };
config = mkIf (config.i18n.inputMethod.enabled == "ibus") { config = mkIf (config.i18n.inputMethod.enabled == "ibus") {
i18n.inputMethod.package = ibusPackage;
# Without dconf enabled it is impossible to use IBus # Without dconf enabled it is impossible to use IBus
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
ibusPackage ibus-qt gnome3.dconf ibusAutostart ibus-qt gnome3.dconf ibusAutostart
]; ];
environment.variables = { environment.variables = {

View File

@ -3,7 +3,7 @@
with lib; with lib;
{ {
config = mkIf (config.i18n.inputMethod.enabled == "nabi") { config = mkIf (config.i18n.inputMethod.enabled == "nabi") {
environment.systemPackages = [ pkgs.nabi ]; i18n.inputMethod.package = pkgs.nabi;
environment.variables = { environment.variables = {
GTK_IM_MODULE = "nabi"; GTK_IM_MODULE = "nabi";

View File

@ -22,7 +22,7 @@ in
}; };
config = mkIf (config.i18n.inputMethod.enabled == "uim") { config = mkIf (config.i18n.inputMethod.enabled == "uim") {
environment.systemPackages = [ pkgs.uim ]; i18n.inputMethod.package = pkgs.uim;
environment.variables = { environment.variables = {
GTK_IM_MODULE = "uim"; GTK_IM_MODULE = "uim";