From 77c413926230eb4fda6be41f666f5603129bbf73 Mon Sep 17 00:00:00 2001 From: Eric Sagnes Date: Mon, 4 Apr 2016 18:06:48 +0900 Subject: [PATCH] gtk3: make gtk3 look for immodule cache in $NIX_PROFILE --- .../libraries/gtk+/3.0-immodules.cache.patch | 27 +++++++++++++++++++ pkgs/development/libraries/gtk+/3.x.nix | 9 ++----- 2 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 pkgs/development/libraries/gtk+/3.0-immodules.cache.patch diff --git a/pkgs/development/libraries/gtk+/3.0-immodules.cache.patch b/pkgs/development/libraries/gtk+/3.0-immodules.cache.patch new file mode 100644 index 00000000000..bbe5f28dbd3 --- /dev/null +++ b/pkgs/development/libraries/gtk+/3.0-immodules.cache.patch @@ -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) + { + diff --git a/pkgs/development/libraries/gtk+/3.x.nix b/pkgs/development/libraries/gtk+/3.x.nix index a2da4c7b033..45003e17f97 100644 --- a/pkgs/development/libraries/gtk+/3.x.nix +++ b/pkgs/development/libraries/gtk+/3.x.nix @@ -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";