diff --git a/doc/stdenv.xml b/doc/stdenv.xml
index 1846886919d7..74eb63b4b498 100644
--- a/doc/stdenv.xml
+++ b/doc/stdenv.xml
@@ -298,6 +298,13 @@ executed and in what order:
+
+ preFixupPhases
+
+ Additional phases executed just before the fixup phase.
+
+
+
preDistPhases
diff --git a/pkgs/desktops/gnome-3/core/baobab/default.nix b/pkgs/desktops/gnome-3/core/baobab/default.nix
index 07805644d906..5121f1f69bec 100644
--- a/pkgs/desktops/gnome-3/core/baobab/default.nix
+++ b/pkgs/desktops/gnome-3/core/baobab/default.nix
@@ -1,7 +1,7 @@
{ stdenv, intltool, fetchurl, vala, libgtop
, pkgconfig, gtk3, glib, hicolor_icon_theme
, bash, makeWrapper, itstool, libxml2
-, gnome3, librsvg, gdk_pixbuf }:
+, gnome3, librsvg, gdk_pixbuf, file }:
stdenv.mkDerivation rec {
name = "baobab-3.10.1";
@@ -22,19 +22,14 @@ stdenv.mkDerivation rec {
hicolor_icon_theme gnome3.gnome_icon_theme_symbolic ];
buildInputs = [ vala pkgconfig gtk3 glib libgtop intltool itstool libxml2
- gnome3.gsettings_desktop_schemas makeWrapper ];
-
- installFlags = "gsettingsschemadir=\${out}/share/baobab/glib-2.0/schemas/";
-
- postInstall = ''
- wrapProgram "$out/bin/baobab" \
- --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
- --prefix XDG_DATA_DIRS : "${gtk3}/share:${gnome3.gnome_themes_standard}/share:${gnome3.gsettings_desktop_schemas}/share:$out/share:$out/share/baobab:$XDG_ICON_DIRS"
- '';
+ gnome3.gsettings_desktop_schemas makeWrapper file ];
preFixup = ''
rm $out/share/icons/hicolor/icon-theme.cache
rm $out/share/icons/HighContrast/icon-theme.cache
+ wrapProgram "$out/bin/baobab" \
+ --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
+ --prefix XDG_DATA_DIRS : "${gtk3}/share:${gnome3.gnome_themes_standard}/share:${gnome3.gsettings_desktop_schemas}/share:$out/share:$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH"
'';
meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index af4b152dccee..033a1def3ce7 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -48,6 +48,8 @@ stdenv.mkDerivation rec {
sha256 = "1d98mbqjmc34s8095lkw1j1bwvnnkw9581yfvjaikjvfjsaz29qd";
};
+ setupHook = ./setup-hook.sh;
+
buildInputs = [ libelf ]
++ optionals doCheck [ tzdata libxml2 desktop_file_utils shared_mime_info ];
diff --git a/pkgs/development/libraries/glib/setup-hook.sh b/pkgs/development/libraries/glib/setup-hook.sh
new file mode 100644
index 000000000000..e5c0c372da00
--- /dev/null
+++ b/pkgs/development/libraries/glib/setup-hook.sh
@@ -0,0 +1,17 @@
+# Install gschemas, if any, in a package-specific directory
+installFlagsArray+=("gsettingsschemadir=$out/gsettings-schemas/$name/glib-2.0/schemas/")
+
+make_glib_find_gsettings_schemas() {
+ # For packages that need gschemas of other packages (e.g. empathy)
+ if [ -d "$1/gsettings-schemas/*/glib-2.0/schemas" ]; then
+ addToSearchPath GSETTINGS_SCHEMAS_PATH "$1/gsettings-schemas/"*
+ fi
+}
+
+envHooks+=(make_glib_find_gsettings_schemas)
+
+glibPreFixupPhase() {
+ addToSearchPath GSETTINGS_SCHEMAS_PATH "$out/gsettings-schemas/$name"
+}
+
+preFixupPhases="$preFixupPhases glibPreFixupPhase"
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 4740c6386339..d79131ac0670 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -877,7 +877,7 @@ genericBuild() {
if [ -z "$phases" ]; then
phases="$prePhases unpackPhase patchPhase $preConfigurePhases \
configurePhase $preBuildPhases buildPhase checkPhase \
- $preInstallPhases installPhase fixupPhase installCheckPhase \
+ $preInstallPhases installPhase $preFixupPhases fixupPhase installCheckPhase \
$preDistPhases distPhase $postPhases";
fi
diff --git a/pkgs/stdenv/mingw/setup.sh b/pkgs/stdenv/mingw/setup.sh
index 592580a829e3..c757eb7ae54c 100755
--- a/pkgs/stdenv/mingw/setup.sh
+++ b/pkgs/stdenv/mingw/setup.sh
@@ -725,7 +725,7 @@ genericBuild() {
if test -z "$phases"; then
phases="$prePhases unpackPhase patchPhase $preConfigurePhases \
configurePhase $preBuildPhases buildPhase checkPhase \
- $preInstallPhases installPhase fixupPhase \
+ $preInstallPhases installPhase $preFixupPhases fixupPhase \
$preDistPhases distPhase $postPhases";
fi