about summary refs log tree commit diff
path: root/pkgs/os-specific/linux/power-profiles-daemon
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2024-04-24 08:53:35 +0200
committerJan Tojnar <jtojnar@gmail.com>2024-04-24 08:58:36 +0200
commiteb8c2956daef26a8f3b563c91ef64bc4840ed50b (patch)
treee6f9f0b4d6f3c8007bae552e18b32727c538b7f1 /pkgs/os-specific/linux/power-profiles-daemon
parent1b357187a91bcfcc191578f16badf76261d6bb85 (diff)
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.
Diffstat (limited to 'pkgs/os-specific/linux/power-profiles-daemon')
-rw-r--r--pkgs/os-specific/linux/power-profiles-daemon/default.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/power-profiles-daemon/default.nix b/pkgs/os-specific/linux/power-profiles-daemon/default.nix
index 11f26e5013a82..f7145bc02ebe7 100644
--- a/pkgs/os-specific/linux/power-profiles-daemon/default.nix
+++ b/pkgs/os-specific/linux/power-profiles-daemon/default.nix
@@ -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;