glib: Add helpers for finding schema datadir

It is commonly needed for test environments.
main
Jan Tojnar 2 years ago
parent a10675f43d
commit 7e95149bdb
  1. 2
      pkgs/desktops/gnome/apps/seahorse/default.nix
  2. 6
      pkgs/development/libraries/glib/default.nix
  3. 2
      pkgs/development/libraries/libadwaita/default.nix
  4. 2
      pkgs/development/libraries/libhandy/default.nix

@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
# Add “org.gnome.crypto.pgp” GSettings schema to path
# to make it available for “gpgme-backend” test.
# It is used by Seahorse’s internal “common” library.
addToSearchPath XDG_DATA_DIRS "${glib.getSchemaPath gcr}/../.."
addToSearchPath XDG_DATA_DIRS "${glib.getSchemaDataDirPath gcr}"
# The same test also requires home directory so that it can store settings.
export HOME=$TMPDIR
'';

@ -191,8 +191,12 @@ stdenv.mkDerivation rec {
passthru = rec {
gioModuleDir = "lib/gio/modules";
makeSchemaPath = dir: name: "${dir}/share/gsettings-schemas/${name}/glib-2.0/schemas";
makeSchemaDataDirPath = dir: name: "${dir}/share/gsettings-schemas/${name}";
makeSchemaPath = dir: name: "${makeSchemaDataDirPath dir name}/glib-2.0/schemas";
getSchemaPath = pkg: makeSchemaPath pkg pkg.name;
getSchemaDataDirPath = pkg: makeSchemaDataDirPath pkg pkg.name;
inherit flattenInclude;
updateScript = gnome.updateScript { packageName = "glib"; };
};

@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
# AdwSettings needs to be initialized from “org.gnome.desktop.interface” GSettings schema when portal is not used for color scheme.
# It will not actually be used since the “color-scheme” key will only have been introduced in GNOME 42, falling back to detecting theme name.
# See adw_settings_constructed function in https://gitlab.gnome.org/GNOME/libadwaita/commit/60ec69f0a5d49cad8a6d79e4ecefd06dc6e3db12
"XDG_DATA_DIRS=${glib.getSchemaPath gsettings-desktop-schemas}/../.."
"XDG_DATA_DIRS=${glib.getSchemaDataDirPath gsettings-desktop-schemas}"
# Tests need a cache directory
"HOME=$TMPDIR"

@ -94,7 +94,7 @@ stdenv.mkDerivation rec {
# HdySettings needs to be initialized from “org.gnome.desktop.interface” GSettings schema when portal is not used for color scheme.
# It will not actually be used since the “color-scheme” key will only have been introduced in GNOME 42, falling back to detecting theme name.
# See hdy_settings_constructed function in https://gitlab.gnome.org/GNOME/libhandy/-/commit/bb68249b005c445947bfb2bee66c91d0fe9c41a4
"${glib.getSchemaPath gsettings-desktop-schemas}/../.."
(glib.getSchemaDataDirPath gsettings-desktop-schemas)
# Some tests require icons
"${hicolor-icon-theme}/share"

Loading…
Cancel
Save