power-profiles-daemon: Fix missing typelib

gobject-instrospection before version 1.80 shipped typelibs for GLib.
As a result, programs relying on libgirepository such as those using pygobject3
would find the GLib typelibs without being wrapped at all.

In GNOME 46, the GLib typelibs were moved to glib package. So if we want
a program to find them, they need to be explicitly passed through `GI_TYPELIB_PATH`
environment variable.

This can be demonstrated by running `GI_TYPELIB_PATH= powerprofilesctl`:

    ImportError: cannot import name Gio, introspection typelib not found

Let’s add the library to path using a wrapper.
This commit is contained in:
Jan Tojnar 2024-04-24 08:53:35 +02:00
parent 1b357187a9
commit eb8c2956da

@ -11,6 +11,7 @@
, polkit
, dbus
, gobject-introspection
, wrapGAppsNoGuiHook
, gettext
, gtk-doc
, docbook-xsl-nons
@ -49,6 +50,7 @@ stdenv.mkDerivation rec {
libxml2 # for xmllint for stripping GResources
libxslt # for xsltproc for building docs
gobject-introspection
wrapGAppsNoGuiHook
# checkInput but cheked for during the configuring
(python3.pythonOnBuildForHost.withPackages (ps: with ps; [
pygobject3
@ -95,6 +97,9 @@ stdenv.mkDerivation rec {
doCheck = true;
# Only need to wrap the Python tool (powerprofilectl)
dontWrapGApps = true;
PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "${placeholder "out"}/share/polkit-1/actions";
postPatch = ''
@ -106,6 +111,10 @@ stdenv.mkDerivation rec {
src/powerprofilesctl
'';
postFixup = ''
wrapGApp "$out/bin/powerprofilesctl"
'';
passthru = {
tests = {
nixos = nixosTests.power-profiles-daemon;