From 88f749545c8a3299bdf6f856285c32058063f6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Tue, 16 Jun 2020 15:55:01 +0200 Subject: [PATCH 1/2] hplip: Add missing library Otherwise, things like `hp-setup` fail finding gi: ``` HP Linux Imaging and Printing System (ver. 3.20.5) Printer/Fax Setup Utility ver. 9.0 Copyright (c) 2001-18 HP Development Company, LP This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to distribute it under certain conditions. See COPYING file for more details. Traceback (most recent call last): File "/nix/store/rmzq8c4n47s4q4p31w18waz0zrba2ljl-hplip-3.20.5/share/hplip/setup.py", line 314, in ui = import_module(ui_package + ".setupdialog") File "/nix/store/n0b076p351ma864q38if4yglsg99hw2s-python3-3.8.3/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 783, in exec_module File "", line 219, in _call_with_frames_removed File "/nix/store/rmzq8c4n47s4q4p31w18waz0zrba2ljl-hplip-3.20.5/share/hplip/ui5/setupdialog.py", line 31, in from base import device, utils, models, pkit File "/nix/store/rmzq8c4n47s4q4p31w18waz0zrba2ljl-hplip-3.20.5/share/hplip/base/pkit.py", line 38, in from gi import _gobject as gobject ModuleNotFoundError: No module named 'gi' ``` --- pkgs/misc/drivers/hplip/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/misc/drivers/hplip/default.nix b/pkgs/misc/drivers/hplip/default.nix index 2ecd163fbf2..daedbe73e20 100644 --- a/pkgs/misc/drivers/hplip/default.nix +++ b/pkgs/misc/drivers/hplip/default.nix @@ -72,7 +72,7 @@ python3Packages.buildPythonApplication { pythonPath = with python3Packages; [ dbus pillow - pygobject2 + pygobject3 reportlab usbutils sip From 907353b1e43195af775c6dc2075479774cb49783 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 16 Jun 2020 20:34:30 +0200 Subject: [PATCH 2/2] hplip: use wrapQtApp Otherwise, things like hp-setup segfault if you run them from another nixpkgs checkout: ``` HP Linux Imaging and Printing System (ver. 3.20.5) Printer/Fax Setup Utility ver. 9.0 Copyright (c) 2001-18 HP Development Company, LP This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to distribute it under certain conditions. See COPYING file for more details. qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. [1] 4543 abort (core dumped) result/bin/hp-setup ``` --- pkgs/misc/drivers/hplip/default.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/misc/drivers/hplip/default.nix b/pkgs/misc/drivers/hplip/default.nix index daedbe73e20..98ced28b877 100644 --- a/pkgs/misc/drivers/hplip/default.nix +++ b/pkgs/misc/drivers/hplip/default.nix @@ -5,7 +5,7 @@ , net-snmp, openssl, perl, nettools , bash, coreutils, utillinux # To remove references to gcc-unwrapped -, removeReferencesTo +, removeReferencesTo, qt5 , withQt5 ? true , withPlugin ? false , withStaticPPDInstall ? false @@ -67,7 +67,10 @@ python3Packages.buildPythonApplication { zlib ]; - nativeBuildInputs = [ pkgconfig removeReferencesTo ]; + nativeBuildInputs = [ + pkgconfig + removeReferencesTo + ] ++ stdenv.lib.optional withQt5 qt5.wrapQtAppsHook; pythonPath = with python3Packages; [ dbus @@ -219,6 +222,10 @@ python3Packages.buildPythonApplication { --replace {,${utillinux}/bin/}logger \ --replace {/usr,$out}/bin remove-references-to -t ${stdenv.cc.cc} $(readlink -f $out/lib/*.so) + '' + stdenv.lib.optionalString withQt5 '' + for f in $out/bin/hp-*;do + wrapQtApp $f + done ''; # There are some binaries there, which reference gcc-unwrapped otherwise.