diff --git a/doc/languages-frameworks/gnome.xml b/doc/languages-frameworks/gnome.xml
index 159216ca981..f555cacbd2c 100644
--- a/doc/languages-frameworks/gnome.xml
+++ b/doc/languages-frameworks/gnome.xml
@@ -28,6 +28,22 @@
+
+ GdkPixbuf loaders
+
+
+ GTK applications typically use GdkPixbuf to load images. But gdk-pixbuf package only supports basic bitmap formats like JPEG, PNG or TIFF, requiring to use third-party loader modules for other formats. This is especially painful since GTK itself includes SVG icons, which cannot be rendered without a loader provided by librsvg.
+
+
+
+ Unlike other libraries mentioned in this section, GdkPixbuf only supports a single value in its controlling environment variable GDK_PIXBUF_MODULE_FILE. It is supposed to point to a cache file containing information about the available loaders. Each loader package will contain a lib/gdk-pixbuf-2.0/2.10.0/loaders.cache file describing the default loaders in gdk-pixbuf package plus the loader contained in the package itself. If you want to use multiple third-party loaders, you will need to create your own cache file manually. Fortunately, this is pretty rare as not many loaders exist.
+
+
+
+ gdk-pixbuf contains a setup hook that sets GDK_PIXBUF_MODULE_FILE from dependencies but as mentioned in further section, it is pretty limited. Loaders should propagate this setup hook.
+
+
+
Icons
@@ -100,9 +116,16 @@ preFixup = ''
done
'';
- Fortunately, there is wrapGAppsHook, that does the wrapping for us. In particular, it works in conjunction with other setup hooks that will populate the variable:
+
+
+ Fortunately, there is wrapGAppsHook. It works in conjunction with other setup hooks that populate environment variables, and it will then wrap all executables in bin and libexec directories using said variables.
+
+
+ For convenience, it also adds dconf.lib for a GIO module implementing a GSettings backend using dconf, gtk3 for GSettings schemas, and librsvg for GdkPixbuf loader to the closure. In case you are packaging a program without a graphical interface, you might want to use wrapGAppsNoGuiHook, which runs the same script as wrapGAppsHook but does not bring gtk3 and librsvg into the closure.
+
+
-
+ wrapGAppsHook itself will add the package’s share directory to XDG_DATA_DIRS.
@@ -112,6 +135,11 @@ preFixup = ''
glib setup hook will populate GSETTINGS_SCHEMAS_PATH and then wrapGAppsHook will prepend it to XDG_DATA_DIRS.
+
+
+ gdk-pixbuf setup hook will populate GDK_PIXBUF_MODULE_FILE with the path to biggest loaders.cache file from the dependencies containing GdkPixbuf loaders. This works fine when there are only two packages containing loaders (gdk-pixbuf and e.g. librsvg) – it will choose the second one, reasonably expecting that it will be bigger since it describes extra loader in addition to the default ones. But when there are more than two loader packages, this logic will break. One possible solution would be constructing a custom cache file for each package containing a program like services/x11/gdk-pixbuf.nix NixOS module does. wrapGAppsHook copies the GDK_PIXBUF_MODULE_FILE environment variable into the produced wrapper.
+
+
One of gtk3’s setup hooks will remove icon-theme.cache files from package’s icon theme directories to avoid conflicts. Icon theme packages should prevent this with dontDropIconThemeCache = true;.
@@ -178,7 +206,7 @@ preFixup = ''
- There are no schemas avalable in XDG_DATA_DIRS. Temporarily add a random package containing schemas like gsettings-desktop-schemas to buildInputs. glib and wrapGAppsHook setup hooks will take care of making the schemas available to application and you will see the actual missing schemas with the next error. Or you can try looking through the source code for the actual schemas used.
+ There are no schemas available in XDG_DATA_DIRS. Temporarily add a random package containing schemas like gsettings-desktop-schemas to buildInputs. glib and wrapGAppsHook setup hooks will take care of making the schemas available to application and you will see the actual missing schemas with the next error. Or you can try looking through the source code for the actual schemas used.
diff --git a/doc/stdenv/stdenv.xml b/doc/stdenv/stdenv.xml
index 46ee97927ea..282893b0ca2 100644
--- a/doc/stdenv/stdenv.xml
+++ b/doc/stdenv/stdenv.xml
@@ -1989,7 +1989,7 @@ addEnvHooks "$hostOffset" myBashFunction
- Exports GDK_PIXBUF_MODULE_FILE environment variable to the builder. Add librsvg package to buildInputs to get svg support.
+ Exports GDK_PIXBUF_MODULE_FILE environment variable to the builder. Add librsvg package to buildInputs to get svg support. See also .
diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix
index 5a87893d972..d0ea088bf71 100644
--- a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix
+++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix
@@ -3,6 +3,7 @@
, makeSetupHook
, makeWrapper
, gobject-introspection
+, isGraphical ? true
, gtk3
, librsvg
, dconf
@@ -21,7 +22,7 @@ makeSetupHook {
# Unfortunately, it also requires the user to have dconf
# D-Bus service enabled globally (e.g. through a NixOS module).
dconf.lib
- ] ++ [
+ ] ++ lib.optionals isGraphical [
# TODO: remove this, packages should depend on GTK explicitly.
gtk3
@@ -30,6 +31,7 @@ makeSetupHook {
# graphics in GTK (e.g. cross for closing window in window title bar)
# so it is pretty much required for applications using GTK.
librsvg
+ ] ++ [
# We use the wrapProgram function.
makeWrapper
diff --git a/pkgs/development/libraries/gtk/3.x.nix b/pkgs/development/libraries/gtk/3.x.nix
index 2cae9546b74..aee846ccfcd 100644
--- a/pkgs/development/libraries/gtk/3.x.nix
+++ b/pkgs/development/libraries/gtk/3.x.nix
@@ -30,6 +30,8 @@
, gnome3
, gsettings-desktop-schemas
, sassc
+, trackerSupport ? stdenv.isLinux
+, tracker
, x11Support ? stdenv.isLinux
, waylandSupport ? stdenv.isLinux
, mesa
@@ -91,6 +93,7 @@ stdenv.mkDerivation rec {
mesonFlags = [
"-Dgtk_doc=${boolToString withGtkDoc}"
"-Dtests=false"
+ "-Dtracker3=${boolToString trackerSupport}"
];
# These are the defines that'd you'd get with --enable-debug=minimum (default).
@@ -137,6 +140,7 @@ stdenv.mkDerivation rec {
isocodes
]
++ optional stdenv.isDarwin AppKit
+ ++ optional trackerSupport tracker
;
propagatedBuildInputs = with xorg; [
diff --git a/pkgs/development/libraries/tracker/default.nix b/pkgs/development/libraries/tracker/default.nix
index 40ab73405ae..ee50d654795 100644
--- a/pkgs/development/libraries/tracker/default.nix
+++ b/pkgs/development/libraries/tracker/default.nix
@@ -12,7 +12,7 @@
, docbook_xml_dtd_45
, libxml2
, glib
-, wrapGAppsHook
+, wrapGAppsNoGuiHook
, vala
, sqlite
, libxslt
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
asciidoc
gettext
libxslt
- wrapGAppsHook
+ wrapGAppsNoGuiHook
gobject-introspection
gtk-doc
docbook-xsl-nons
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index bbb0884bb0c..694c8c2073e 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -540,6 +540,8 @@ in
wrapGAppsHook = callPackage ../build-support/setup-hooks/wrap-gapps-hook { };
+ wrapGAppsNoGuiHook = wrapGAppsHook.override { isGraphical = false; };
+
separateDebugInfo = makeSetupHook { } ../build-support/setup-hooks/separate-debug-info.sh;
setupDebugInfoDirs = makeSetupHook { } ../build-support/setup-hooks/setup-debug-info-dirs.sh;