diff --git a/doc/languages-frameworks/gnome.section.md b/doc/languages-frameworks/gnome.section.md index 62766b2c153ce..73f296737a40b 100644 --- a/doc/languages-frameworks/gnome.section.md +++ b/doc/languages-frameworks/gnome.section.md @@ -34,11 +34,11 @@ To allow software to use various virtual file systems, `gvfs` package can be als ### GdkPixbuf loaders {#ssec-gnome-gdk-pixbuf-loaders} -GTK applications typically use [GdkPixbuf](https://developer.gnome.org/gdk-pixbuf/stable/) 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. GTK itself includes SVG icons, which cannot be rendered without a loader provided by `librsvg`. +GTK applications typically use [GdkPixbuf](https://developer.gnome.org/gdk-pixbuf/stable/) to load images. But `gdk-pixbuf` package only supports basic bitmap formats like JPEG, PNG or TIFF, requiring third-party loader modules for other formats. GTK itself includes SVG icons, which cannot be rendered without a loader provided by `librsvg`. Each loader package will contain a `lib/gdk-pixbuf-2.0/2.10.0/loaders.cache` file containing information about the available loaders. GdkPixbuf looks for these files in the `GDK_PIXBUF_MODULE_FILE` environment variable. Although upstream GdkPixbuf only supports a single file, in nixpkgs it is patched to accept multiple files, separated by `:`. -[`wrapGAppsHook`]{#ssec-gnome-hooks-wrapgappshook} handles setting `GDK_PIXBUF_MODULE_FILE` for GTK apps. If you're manually constructing a wrapper, consider `--prefix`ing the variable rather than overwriting it, so that users can extend your program's capabilities through `services.xserver.gdk-pixbuf.modulePackages`. +[`wrapGAppsHook`](#ssec-gnome-hooks-wrapgappshook) handles setting `GDK_PIXBUF_MODULE_FILE` for GTK apps. If you're manually constructing a wrapper, consider `--prefix`ing the variable rather than overwriting it, so that users can extend your program's capabilities through `services.xserver.gdk-pixbuf.modulePackages`. ### Icons {#ssec-gnome-icons} 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 535db9a04dbc6..274e8f0806731 100644 --- a/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/default.nix @@ -38,8 +38,8 @@ makeSetupHook { makeWrapper ]; substitutions = { - STANDARD_GDK_PIXBUF_MODULES = lib.makeSearchPathOutput "lib" gdk-pixbuf.cacheFile [ gdk-pixbuf librsvg ]; - GDK_PIXBUF_CACHE_FILE = gdk-pixbuf.cacheFile; + standardGdkPixbufModules = lib.makeSearchPathOutput "lib" gdk-pixbuf.cacheFile [ gdk-pixbuf librsvg ]; + gdkPixbufCacheFile = gdk-pixbuf.cacheFile; passthru.tests = let sample-project = ./tests/sample-project; @@ -71,11 +71,15 @@ makeSetupHook { # Stopgap as no modules have been packaged yet mock-pixbuf-module = stdenv.mkDerivation { name = "mock-gdk-pixbuf-module"; - outputs = ["lib"]; - builder = '' + outputs = ["out" "lib"]; + dontUnpack = true; + buildPhase = '' + mkdir -p $out mkdir -p $lib/$(dirname ${gdk-pixbuf.cacheFile}) touch $lib/${gdk-pixbuf.cacheFile} ''; + dontInstall = true; + dontFixup = true; }; pixbuf-modules = basic.overrideAttrs (old: {extraGdkPixbufModules = [mock-pixbuf-module];}); @@ -83,12 +87,12 @@ makeSetupHook { pixbuf-modules-check = let tested = pixbuf-modules; in testLib.runTest "pixbuf-modules-check" '' - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GDK_PIXBUF_MODULE_FILE=" "${gdk-pixbuf}/${gdk-pixbuf.cacheFile}"} - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GDK_PIXBUF_MODULE_FILE=" "${librsvg}/${gdk-pixbuf.cacheFile}"} - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GDK_PIXBUF_MODULE_FILE=" "${mock-pixbuf-module}/${gdk-pixbuf.cacheFile}"} - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GDK_PIXBUF_MODULE_FILE=" "${gdk-pixbuf}/${gdk-pixbuf.cacheFile}"} - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GDK_PIXBUF_MODULE_FILE=" "${librsvg}/${gdk-pixbuf.cacheFile}"} - ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GDK_PIXBUF_MODULE_FILE=" "${mock-pixbuf-module}/${gdk-pixbuf.cacheFile}"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GDK_PIXBUF_MODULE_FILE" "${gdk-pixbuf}/${gdk-pixbuf.cacheFile}"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GDK_PIXBUF_MODULE_FILE" "${librsvg}/${gdk-pixbuf.cacheFile}"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/bin/foo" "GDK_PIXBUF_MODULE_FILE" "${mock-pixbuf-module}/${gdk-pixbuf.cacheFile}"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GDK_PIXBUF_MODULE_FILE" "${gdk-pixbuf}/${gdk-pixbuf.cacheFile}"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GDK_PIXBUF_MODULE_FILE" "${librsvg}/${gdk-pixbuf.cacheFile}"} + ${expectSomeLineContainingYInFileXToMentionZ "${tested}/libexec/bar" "GDK_PIXBUF_MODULE_FILE" "${mock-pixbuf-module}/${gdk-pixbuf.cacheFile}"} ''; # Simple derivation containing a gobject-introspection typelib. diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook/wrap-gapps-hook.sh b/pkgs/build-support/setup-hooks/wrap-gapps-hook/wrap-gapps-hook.sh index 4d7a1988919f2..a3b75ffa2761d 100644 --- a/pkgs/build-support/setup-hooks/wrap-gapps-hook/wrap-gapps-hook.sh +++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook/wrap-gapps-hook.sh @@ -11,11 +11,11 @@ addEnvHooks "${targetOffset:?}" find_gio_modules gappsWrapperArgsHook() { - gappsWrapperArgs+=(--prefix GDK_PIXBUF_MODULE_FILE : "@STANDARD_GDK_PIXBUF_MODULES@") + gappsWrapperArgs+=(--prefix GDK_PIXBUF_MODULE_FILE : "@standardGdkPixbufModules@") if [ -n "$extraGdkPixbufModules" ]; then for pkg in $extraGdkPixbufModules; do - gappsWrapperArgs+=(--prefix GDK_PIXBUF_MODULE_FILE : "$pkg/@GDK_PIXBUF_CACHE_FILE@") + gappsWrapperArgs+=(--prefix GDK_PIXBUF_MODULE_FILE : "$pkg/@gdkPixbufCacheFile@") done fi