Merge commit 'refs/pull/14568/head' of git://github.com/NixOS/nixpkgs into staging

This commit is contained in:
Nikolay Amiantov 2016-05-07 03:44:06 +03:00
commit c99b050af0
10 changed files with 105 additions and 14 deletions

View file

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

View file

@ -1,10 +1,32 @@
{ config, pkgs, 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 = {
i18n.inputMethod = {
options.i18n = {
inputMethod = {
enabled = mkOption {
type = types.nullOr (types.enum [ "ibus" "fcitx" "nabi" "uim" ]);
default = null;
@ -24,6 +46,20 @@ with lib;
</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") {
environment.systemPackages = [ fcitxPackage ];
i18n.inputMethod.package = fcitxPackage;
environment.variables = {
GTK_IM_MODULE = "fcitx";

View file

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

View file

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

View file

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

View file

@ -0,0 +1,27 @@
--- a/gtk/gtkrc.c 2014-09-30 05:02:17.000000000 +0900
+++ b/gtk/gtkrc.c 2016-04-09 17:39:51.363288355 +0900
@@ -445,5 +445,23 @@
if (var)
result = g_strdup (var);
+ // check NIX_PROFILES paths.
+ const gchar *nixProfilesEnv = g_getenv ("NIX_PROFILES");
+ gchar *cachePath;
+ guint i;
+
+ if(nixProfilesEnv && !result){
+ gchar **paths = g_strsplit(nixProfilesEnv, " ", -1);
+ for (i = 0; paths[i] != NULL; i++){
+ cachePath = g_build_filename(paths[i], "etc", "gtk-2.0", "immodules.cache", NULL);
+ if( g_file_test( cachePath, G_FILE_TEST_EXISTS) ){
+ if(result) g_free(result);
+ result = g_strdup(cachePath);
+ }
+ g_free(cachePath);
+ }
+ g_strfreev(paths);
+ }
+
if (!result)
{

View file

@ -26,6 +26,8 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ setupHook perl pkgconfig gettext ];
patches = [ ./2.0-immodules.cache.patch ];
propagatedBuildInputs = with xorg; with stdenv.lib;
[ glib cairo pango gdk_pixbuf atk ]
++ optionals (stdenv.isLinux || stdenv.isDarwin) [

View file

@ -0,0 +1,27 @@
--- a/gtk/deprecated/gtkrc.c 2016-04-02 18:43:08.401663112 +0900
+++ b/gtk/deprecated/gtkrc.c 2016-04-02 18:29:19.927608592 +0900
@@ -774,5 +774,23 @@
if (var)
result = g_strdup (var);
+ // check NIX_PROFILES paths.
+ const gchar *nixProfilesEnv = g_getenv ("NIX_PROFILES");
+ gchar *cachePath;
+ guint i;
+
+ if(nixProfilesEnv && !result){
+ gchar **paths = g_strsplit(nixProfilesEnv, " ", -1);
+ for (i = 0; paths[i] != NULL; i++){
+ cachePath = g_build_filename(paths[i], "etc", "gtk-3.0", "immodules.cache", NULL);
+ if( g_file_test( cachePath, G_FILE_TEST_EXISTS) ){
+ if(result) g_free(result);
+ result = g_strdup(cachePath);
+ }
+ g_free(cachePath);
+ }
+ g_strfreev(paths);
+ }
+
if (!result)
{

View file

@ -28,6 +28,8 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkgconfig gettext gobjectIntrospection perl ];
patches = [ ./3.0-immodules.cache.patch ];
buildInputs = [ libxkbcommon epoxy json_glib ];
propagatedBuildInputs = with xorg; with stdenv.lib;
[ expat glib cairo pango gdk_pixbuf atk at_spi2_atk
@ -58,13 +60,6 @@ stdenv.mkDerivation rec {
--replace '-L${gmp.dev}/lib' '-L${gmp.out}/lib'
'';
passthru = {
gtkExeEnvPostBuild = ''
rm $out/lib/gtk-3.0/3.0.0/immodules.cache
$out/bin/gtk-query-immodules-3.0 $out/lib/gtk-3.0/3.0.0/immodules/*.so > $out/lib/gtk-3.0/3.0.0/immodules.cache
''; # workaround for bug of nix-mode for Emacs */ '';
};
meta = with stdenv.lib; {
description = "A multi-platform toolkit for creating graphical user interfaces";