aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/3.16.11.nix192
-rw-r--r--infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/3.18.5.nix229
-rw-r--r--infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/default.nix246
-rw-r--r--infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/hplip.state4
-rw-r--r--infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/image-processor.patch115
5 files changed, 786 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/3.16.11.nix b/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/3.16.11.nix
new file mode 100644
index 000000000000..4b9f47d88f94
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/3.16.11.nix
@@ -0,0 +1,192 @@
+{ stdenv, fetchurl, substituteAll
+, pkgconfig
+, cups, libjpeg, libusb1, python2Packages, sane-backends, dbus, usbutils
+, net-snmp, openssl, nettools
+, bash, coreutils, util-linux
+, qtSupport ? true
+, withPlugin ? false
+}:
+
+let
+
+ name = "hplip-${version}";
+ version = "3.16.11";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/hplip/${name}.tar.gz";
+ sha256 = "094vkyr0rjng72m13dgr824cdl7q20x23qjxzih4w7l9njn0rqpn";
+ };
+
+ plugin = fetchurl {
+ url = "http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/${name}-plugin.run";
+ sha256 = "1y3wdax2wb6kdd8bi40wl7v9s8ffyjz95bz42sjcpzzddmlhcaxg";
+ };
+
+ hplipState = substituteAll {
+ inherit version;
+ src = ./hplip.state;
+ };
+
+ hplipPlatforms = {
+ i686-linux = "x86_32";
+ x86_64-linux = "x86_64";
+ armv6l-linux = "arm32";
+ armv7l-linux = "arm32";
+ aarch64-linux = "arm64";
+ };
+
+ hplipArch = hplipPlatforms.${stdenv.hostPlatform.system}
+ or (throw "HPLIP not supported on ${stdenv.hostPlatform.system}");
+
+ pluginArches = [ "x86_32" "x86_64" "arm32" "arm64" ];
+
+in
+
+assert withPlugin -> builtins.elem hplipArch pluginArches
+ || throw "HPLIP plugin not supported on ${stdenv.hostPlatform.system}";
+
+python2Packages.buildPythonApplication {
+ inherit name src;
+ format = "other";
+
+ buildInputs = [
+ libjpeg
+ cups
+ libusb1
+ sane-backends
+ dbus
+ net-snmp
+ openssl
+ ];
+
+ nativeBuildInputs = [
+ pkgconfig
+ ];
+
+ pythonPath = with python2Packages; [
+ dbus
+ pillow
+ pygobject2
+ reportlab
+ usbutils
+ ] ++ stdenv.lib.optionals qtSupport [
+ pyqt4
+ ];
+
+ makeWrapperArgs = [ "--prefix" "PATH" ":" "${nettools}/bin" ];
+
+ prePatch = ''
+ # HPLIP hardcodes absolute paths everywhere. Nuke from orbit.
+ find . -type f -exec sed -i \
+ -e s,/etc/hp,$out/etc/hp, \
+ -e s,/etc/sane.d,$out/etc/sane.d, \
+ -e s,/usr/include/libusb-1.0,${libusb1.dev}/include/libusb-1.0, \
+ -e s,/usr/share/hal/fdi/preprobe/10osvendor,$out/share/hal/fdi/preprobe/10osvendor, \
+ -e s,/usr/lib/systemd/system,$out/lib/systemd/system, \
+ -e s,/var/lib/hp,$out/var/lib/hp, \
+ {} +
+ '';
+
+ preConfigure = ''
+ export configureFlags="$configureFlags
+ --with-hpppddir=$out/share/cups/model/HP
+ --with-cupsfilterdir=$out/lib/cups/filter
+ --with-cupsbackenddir=$out/lib/cups/backend
+ --with-icondir=$out/share/applications
+ --with-systraydir=$out/xdg/autostart
+ --with-mimedir=$out/etc/cups
+ --enable-policykit
+ "
+
+ export makeFlags="
+ halpredir=$out/share/hal/fdi/preprobe/10osvendor
+ rulesdir=$out/etc/udev/rules.d
+ policykit_dir=$out/share/polkit-1/actions
+ policykit_dbus_etcdir=$out/etc/dbus-1/system.d
+ policykit_dbus_sharedir=$out/share/dbus-1/system-services
+ hplip_confdir=$out/etc/hp
+ hplip_statedir=$out/var/lib/hp
+ "
+ '';
+
+ enableParallelBuilding = true;
+
+ postInstall = stdenv.lib.optionalString withPlugin ''
+ sh ${plugin} --noexec --keep
+ cd plugin_tmp
+
+ cp plugin.spec $out/share/hplip/
+
+ mkdir -p $out/share/hplip/data/firmware
+ cp *.fw.gz $out/share/hplip/data/firmware
+
+ mkdir -p $out/share/hplip/data/plugins
+ cp license.txt $out/share/hplip/data/plugins
+
+ mkdir -p $out/share/hplip/prnt/plugins
+ for plugin in lj hbpl1; do
+ cp $plugin-${hplipArch}.so $out/share/hplip/prnt/plugins
+ ln -s $out/share/hplip/prnt/plugins/$plugin-${hplipArch}.so \
+ $out/share/hplip/prnt/plugins/$plugin.so
+ done
+
+ mkdir -p $out/share/hplip/scan/plugins
+ for plugin in bb_soap bb_marvell bb_soapht fax_marvell; do
+ cp $plugin-${hplipArch}.so $out/share/hplip/scan/plugins
+ ln -s $out/share/hplip/scan/plugins/$plugin-${hplipArch}.so \
+ $out/share/hplip/scan/plugins/$plugin.so
+ done
+
+ mkdir -p $out/var/lib/hp
+ cp ${hplipState} $out/var/lib/hp/hplip.state
+
+ mkdir -p $out/etc/sane.d/dll.d
+ mv $out/etc/sane.d/dll.conf $out/etc/sane.d/dll.d/hpaio.conf
+ '';
+
+ # The installed executables are just symlinks into $out/share/hplip,
+ # but wrapPythonPrograms ignores symlinks. We cannot replace the Python
+ # modules in $out/share/hplip with wrapper scripts because they import
+ # each other as libraries. Instead, we emulate wrapPythonPrograms by
+ # 1. Calling patchPythonProgram on the original script in $out/share/hplip
+ # 2. Making our own wrapper pointing directly to the original script.
+ dontWrapPythonPrograms = true;
+ preFixup = ''
+ buildPythonPath "$out $pythonPath"
+
+ for bin in $out/bin/*; do
+ py=$(readlink -m $bin)
+ rm $bin
+ echo "patching \`$py'..."
+ patchPythonScript "$py"
+ echo "wrapping \`$bin'..."
+ makeWrapper "$py" "$bin" \
+ --prefix PATH ':' "$program_PATH" \
+ --set PYTHONNOUSERSITE "true" \
+ $makeWrapperArgs
+ done
+ '';
+
+ postFixup = ''
+ substituteInPlace $out/etc/hp/hplip.conf --replace /usr $out
+ # Patch udev rules:
+ # with plugin, they upload firmware to printers,
+ # without plugin, they complain about the missing plugin.
+ substituteInPlace $out/etc/udev/rules.d/56-hpmud.rules \
+ --replace {,${bash}}/bin/sh \
+ --replace /usr/bin/nohup "" \
+ --replace {,${util-linux}/bin/}logger \
+ --replace {/usr,$out}/bin
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Print, scan and fax HP drivers for Linux";
+ homepage = "http://hplipopensource.com/";
+ downloadPage = "https://sourceforge.net/projects/hplip/files/hplip/";
+ license = if withPlugin
+ then licenses.unfree
+ else with licenses; [ mit bsd2 gpl2Plus ];
+ platforms = [ "i686-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" ];
+ maintainers = with maintainers; [ ttuegel ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/3.18.5.nix b/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/3.18.5.nix
new file mode 100644
index 000000000000..59b3d2b9d634
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/3.18.5.nix
@@ -0,0 +1,229 @@
+{ stdenv, fetchurl, substituteAll
+, pkgconfig
+, cups, zlib, libjpeg, libusb1, python2Packages, sane-backends
+, dbus, file, ghostscript, usbutils
+, net-snmp, openssl, perl, nettools
+, bash, coreutils, util-linux
+, withQt5 ? true
+, withPlugin ? false
+, withStaticPPDInstall ? false
+}:
+
+let
+
+ name = "hplip-${version}";
+ version = "3.18.5";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/hplip/${name}.tar.gz";
+ sha256 = "0xb7ga2wgbwjxsss67mjn2y6fmqsfwzmv11ivvfzhnl36lh22hkb";
+ };
+
+ plugin = fetchurl {
+ url = "https://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/${name}-plugin.run";
+ sha256 = "1jf74jya071zqvwhy9n0c3007pzgcxydkw7qdh4sx70brly81i7p";
+ };
+
+ hplipState = substituteAll {
+ inherit version;
+ src = ./hplip.state;
+ };
+
+ hplipPlatforms = {
+ i686-linux = "x86_32";
+ x86_64-linux = "x86_64";
+ armv6l-linux = "arm32";
+ armv7l-linux = "arm32";
+ aarch64-linux = "arm64";
+ };
+
+ hplipArch = hplipPlatforms.${stdenv.hostPlatform.system}
+ or (throw "HPLIP not supported on ${stdenv.hostPlatform.system}");
+
+ pluginArches = [ "x86_32" "x86_64" "arm32" "arm64" ];
+
+in
+
+assert withPlugin -> builtins.elem hplipArch pluginArches
+ || throw "HPLIP plugin not supported on ${stdenv.hostPlatform.system}";
+
+python2Packages.buildPythonApplication {
+ inherit name src;
+ format = "other";
+
+ buildInputs = [
+ libjpeg
+ cups
+ libusb1
+ sane-backends
+ dbus
+ file
+ ghostscript
+ net-snmp
+ openssl
+ perl
+ zlib
+ ];
+
+ nativeBuildInputs = [
+ pkgconfig
+ ];
+
+ pythonPath = with python2Packages; [
+ dbus
+ pillow
+ pygobject2
+ reportlab
+ usbutils
+ sip
+ ] ++ stdenv.lib.optionals withQt5 [
+ pyqt5
+ ];
+
+ makeWrapperArgs = [ "--prefix" "PATH" ":" "${nettools}/bin" ];
+
+ prePatch = ''
+ # HPLIP hardcodes absolute paths everywhere. Nuke from orbit.
+ find . -type f -exec sed -i \
+ -e s,/etc/hp,$out/etc/hp,g \
+ -e s,/etc/sane.d,$out/etc/sane.d,g \
+ -e s,/usr/include/libusb-1.0,${libusb1.dev}/include/libusb-1.0,g \
+ -e s,/usr/share/hal/fdi/preprobe/10osvendor,$out/share/hal/fdi/preprobe/10osvendor,g \
+ -e s,/usr/lib/systemd/system,$out/lib/systemd/system,g \
+ -e s,/var/lib/hp,$out/var/lib/hp,g \
+ -e s,/usr/bin/perl,${perl}/bin/perl,g \
+ -e s,/usr/bin/file,${file}/bin/file,g \
+ -e s,/usr/bin/gs,${ghostscript}/bin/gs,g \
+ -e s,/usr/share/cups/fonts,${ghostscript}/share/ghostscript/fonts,g \
+ -e "s,ExecStart=/usr/bin/python /usr/bin/hp-config_usb_printer,ExecStart=$out/bin/hp-config_usb_printer,g" \
+ {} +
+ '';
+
+ preConfigure = ''
+ export configureFlags="$configureFlags
+ --with-hpppddir=$out/share/cups/model/HP
+ --with-cupsfilterdir=$out/lib/cups/filter
+ --with-cupsbackenddir=$out/lib/cups/backend
+ --with-icondir=$out/share/applications
+ --with-systraydir=$out/xdg/autostart
+ --with-mimedir=$out/etc/cups
+ --enable-policykit
+ ${stdenv.lib.optionalString withStaticPPDInstall "--enable-cups-ppd-install"}
+ --disable-qt4
+ ${stdenv.lib.optionalString withQt5 "--enable-qt5"}
+ "
+
+ export makeFlags="
+ halpredir=$out/share/hal/fdi/preprobe/10osvendor
+ rulesdir=$out/etc/udev/rules.d
+ policykit_dir=$out/share/polkit-1/actions
+ policykit_dbus_etcdir=$out/etc/dbus-1/system.d
+ policykit_dbus_sharedir=$out/share/dbus-1/system-services
+ hplip_confdir=$out/etc/hp
+ hplip_statedir=$out/var/lib/hp
+ "
+
+ # Prevent 'ppdc: Unable to find include file "<font.defs>"' which prevent
+ # generation of '*.ppd' files.
+ # This seems to be a 'ppdc' issue when the tool is run in a hermetic sandbox.
+ # Could not find how to fix the problem in 'ppdc' so this is a workaround.
+ export CUPS_DATADIR="${cups}/share/cups"
+ '';
+
+ enableParallelBuilding = true;
+
+ #
+ # Running `hp-diagnose_plugin -g` can be used to diagnose
+ # issues with plugins.
+ #
+ postInstall = stdenv.lib.optionalString withPlugin ''
+ sh ${plugin} --noexec --keep
+ cd plugin_tmp
+
+ cp plugin.spec $out/share/hplip/
+
+ mkdir -p $out/share/hplip/data/firmware
+ cp *.fw.gz $out/share/hplip/data/firmware
+
+ mkdir -p $out/share/hplip/data/plugins
+ cp license.txt $out/share/hplip/data/plugins
+
+ mkdir -p $out/share/hplip/prnt/plugins
+ for plugin in lj hbpl1; do
+ cp $plugin-${hplipArch}.so $out/share/hplip/prnt/plugins
+ chmod 0755 $out/share/hplip/prnt/plugins/$plugin-${hplipArch}.so
+ ln -s $out/share/hplip/prnt/plugins/$plugin-${hplipArch}.so \
+ $out/share/hplip/prnt/plugins/$plugin.so
+ done
+
+ mkdir -p $out/share/hplip/scan/plugins
+ for plugin in bb_soap bb_marvell bb_soapht bb_escl; do
+ cp $plugin-${hplipArch}.so $out/share/hplip/scan/plugins
+ chmod 0755 $out/share/hplip/scan/plugins/$plugin-${hplipArch}.so
+ ln -s $out/share/hplip/scan/plugins/$plugin-${hplipArch}.so \
+ $out/share/hplip/scan/plugins/$plugin.so
+ done
+
+ mkdir -p $out/share/hplip/fax/plugins
+ for plugin in fax_marvell; do
+ cp $plugin-${hplipArch}.so $out/share/hplip/fax/plugins
+ chmod 0755 $out/share/hplip/fax/plugins/$plugin-${hplipArch}.so
+ ln -s $out/share/hplip/fax/plugins/$plugin-${hplipArch}.so \
+ $out/share/hplip/fax/plugins/$plugin.so
+ done
+
+ mkdir -p $out/var/lib/hp
+ cp ${hplipState} $out/var/lib/hp/hplip.state
+ '';
+
+ # The installed executables are just symlinks into $out/share/hplip,
+ # but wrapPythonPrograms ignores symlinks. We cannot replace the Python
+ # modules in $out/share/hplip with wrapper scripts because they import
+ # each other as libraries. Instead, we emulate wrapPythonPrograms by
+ # 1. Calling patchPythonProgram on the original script in $out/share/hplip
+ # 2. Making our own wrapper pointing directly to the original script.
+ dontWrapPythonPrograms = true;
+ preFixup = ''
+ buildPythonPath "$out $pythonPath"
+
+ for bin in $out/bin/*; do
+ py=$(readlink -m $bin)
+ rm $bin
+ echo "patching \`$py'..."
+ patchPythonScript "$py"
+ echo "wrapping \`$bin'..."
+ makeWrapper "$py" "$bin" \
+ --prefix PATH ':' "$program_PATH" \
+ --set PYTHONNOUSERSITE "true" \
+ $makeWrapperArgs
+ done
+ '';
+
+ # There are some binaries there, which reference gcc-unwrapped otherwise.
+ stripDebugList = [
+ "share/hplip"
+ ];
+
+ postFixup = ''
+ substituteInPlace $out/etc/hp/hplip.conf --replace /usr $out
+ # Patch udev rules:
+ # with plugin, they upload firmware to printers,
+ # without plugin, they complain about the missing plugin.
+ substituteInPlace $out/etc/udev/rules.d/56-hpmud.rules \
+ --replace {,${bash}}/bin/sh \
+ --replace /usr/bin/nohup "" \
+ --replace {,${util-linux}/bin/}logger \
+ --replace {/usr,$out}/bin
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Print, scan and fax HP drivers for Linux";
+ homepage = "https://developers.hp.com/hp-linux-imaging-and-printing";
+ downloadPage = "https://sourceforge.net/projects/hplip/files/hplip/";
+ license = if withPlugin
+ then licenses.unfree
+ else with licenses; [ mit bsd2 gpl2Plus ];
+ platforms = [ "i686-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" ];
+ maintainers = with maintainers; [ jgeerds ttuegel ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/default.nix b/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/default.nix
new file mode 100644
index 000000000000..b740f5091fa7
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/default.nix
@@ -0,0 +1,246 @@
+{ stdenv, fetchurl, substituteAll
+, pkgconfig
+, cups, zlib, libjpeg, libusb1, python3Packages, sane-backends
+, dbus, file, ghostscript, usbutils
+, net-snmp, openssl, perl, nettools
+, bash, coreutils, util-linux
+# To remove references to gcc-unwrapped
+, removeReferencesTo, qt5
+, withQt5 ? true
+, withPlugin ? false
+, withStaticPPDInstall ? false
+}:
+
+let
+
+ name = "hplip-${version}";
+ version = "3.20.5";
+
+ src = fetchurl {
+ url = "mirror://sourceforge/hplip/${name}.tar.gz";
+ sha256 = "004bbd78487b7803cdcf2a96b00de938797227068c4de43ee7ad7d174c4e475a";
+ };
+
+ plugin = fetchurl {
+ url = "https://developers.hp.com/sites/default/files/${name}-plugin.run";
+ sha256 = "ff3dedda3158be64b985efbf636890ddda5b271ae1f1fbd788219e1344a9c2e7";
+ };
+
+ hplipState = substituteAll {
+ inherit version;
+ src = ./hplip.state;
+ };
+
+ hplipPlatforms = {
+ i686-linux = "x86_32";
+ x86_64-linux = "x86_64";
+ armv6l-linux = "arm32";
+ armv7l-linux = "arm32";
+ aarch64-linux = "aarch64";
+ };
+
+ hplipArch = hplipPlatforms.${stdenv.hostPlatform.system}
+ or (throw "HPLIP not supported on ${stdenv.hostPlatform.system}");
+
+ pluginArches = [ "x86_32" "x86_64" "arm32" "aarch64" ];
+
+in
+
+assert withPlugin -> builtins.elem hplipArch pluginArches
+ || throw "HPLIP plugin not supported on ${stdenv.hostPlatform.system}";
+
+python3Packages.buildPythonApplication {
+ inherit name src;
+ format = "other";
+
+ buildInputs = [
+ libjpeg
+ cups
+ libusb1
+ sane-backends
+ dbus
+ file
+ ghostscript
+ net-snmp
+ openssl
+ perl
+ zlib
+ ];
+
+ nativeBuildInputs = [
+ pkgconfig
+ removeReferencesTo
+ ] ++ stdenv.lib.optional withQt5 qt5.wrapQtAppsHook;
+
+ pythonPath = with python3Packages; [
+ dbus
+ pillow
+ pygobject3
+ reportlab
+ usbutils
+ sip
+ dbus-python
+ ] ++ stdenv.lib.optionals withQt5 [
+ pyqt5
+ enum-compat
+ ];
+
+ makeWrapperArgs = [ "--prefix" "PATH" ":" "${nettools}/bin" ];
+
+ patches = [
+ # remove ImageProcessor usage, it causes segfaults, see
+ # https://bugs.launchpad.net/hplip/+bug/1788706
+ # https://bugs.launchpad.net/hplip/+bug/1787289
+ ./image-processor.patch
+ ];
+
+ prePatch = ''
+ # HPLIP hardcodes absolute paths everywhere. Nuke from orbit.
+ find . -type f -exec sed -i \
+ -e s,/etc/hp,$out/etc/hp,g \
+ -e s,/etc/sane.d,$out/etc/sane.d,g \
+ -e s,/usr/include/libusb-1.0,${libusb1.dev}/include/libusb-1.0,g \
+ -e s,/usr/share/hal/fdi/preprobe/10osvendor,$out/share/hal/fdi/preprobe/10osvendor,g \
+ -e s,/usr/lib/systemd/system,$out/lib/systemd/system,g \
+ -e s,/var/lib/hp,$out/var/lib/hp,g \
+ -e s,/usr/bin/perl,${perl}/bin/perl,g \
+ -e s,/usr/bin/file,${file}/bin/file,g \
+ -e s,/usr/bin/gs,${ghostscript}/bin/gs,g \
+ -e s,/usr/share/cups/fonts,${ghostscript}/share/ghostscript/fonts,g \
+ -e "s,ExecStart=/usr/bin/python /usr/bin/hp-config_usb_printer,ExecStart=$out/bin/hp-config_usb_printer,g" \
+ {} +
+ '';
+
+ preConfigure = ''
+ export configureFlags="$configureFlags
+ --with-hpppddir=$out/share/cups/model/HP
+ --with-cupsfilterdir=$out/lib/cups/filter
+ --with-cupsbackenddir=$out/lib/cups/backend
+ --with-icondir=$out/share/applications
+ --with-systraydir=$out/xdg/autostart
+ --with-mimedir=$out/etc/cups
+ --enable-policykit
+ ${stdenv.lib.optionalString withStaticPPDInstall "--enable-cups-ppd-install"}
+ --disable-qt4
+ ${stdenv.lib.optionalString withQt5 "--enable-qt5"}
+ "
+
+ export makeFlags="
+ halpredir=$out/share/hal/fdi/preprobe/10osvendor
+ rulesdir=$out/etc/udev/rules.d
+ policykit_dir=$out/share/polkit-1/actions
+ policykit_dbus_etcdir=$out/etc/dbus-1/system.d
+ policykit_dbus_sharedir=$out/share/dbus-1/system-services
+ hplip_confdir=$out/etc/hp
+ hplip_statedir=$out/var/lib/hp
+ "
+
+ # Prevent 'ppdc: Unable to find include file "<font.defs>"' which prevent
+ # generation of '*.ppd' files.
+ # This seems to be a 'ppdc' issue when the tool is run in a hermetic sandbox.
+ # Could not find how to fix the problem in 'ppdc' so this is a workaround.
+ export CUPS_DATADIR="${cups}/share/cups"
+ '';
+
+ enableParallelBuilding = true;
+
+ #
+ # Running `hp-diagnose_plugin -g` can be used to diagnose
+ # issues with plugins.
+ #
+ postInstall = stdenv.lib.optionalString withPlugin ''
+ sh ${plugin} --noexec --keep
+ cd plugin_tmp
+
+ cp plugin.spec $out/share/hplip/
+
+ mkdir -p $out/share/hplip/data/firmware
+ cp *.fw.gz $out/share/hplip/data/firmware
+
+ mkdir -p $out/share/hplip/data/plugins
+ cp license.txt $out/share/hplip/data/plugins
+
+ mkdir -p $out/share/hplip/prnt/plugins
+ for plugin in lj hbpl1; do
+ cp $plugin-${hplipArch}.so $out/share/hplip/prnt/plugins
+ chmod 0755 $out/share/hplip/prnt/plugins/$plugin-${hplipArch}.so
+ ln -s $out/share/hplip/prnt/plugins/$plugin-${hplipArch}.so \
+ $out/share/hplip/prnt/plugins/$plugin.so
+ done
+
+ mkdir -p $out/share/hplip/scan/plugins
+ for plugin in bb_soap bb_marvell bb_soapht bb_escl; do
+ cp $plugin-${hplipArch}.so $out/share/hplip/scan/plugins
+ chmod 0755 $out/share/hplip/scan/plugins/$plugin-${hplipArch}.so
+ ln -s $out/share/hplip/scan/plugins/$plugin-${hplipArch}.so \
+ $out/share/hplip/scan/plugins/$plugin.so
+ done
+
+ mkdir -p $out/share/hplip/fax/plugins
+ for plugin in fax_marvell; do
+ cp $plugin-${hplipArch}.so $out/share/hplip/fax/plugins
+ chmod 0755 $out/share/hplip/fax/plugins/$plugin-${hplipArch}.so
+ ln -s $out/share/hplip/fax/plugins/$plugin-${hplipArch}.so \
+ $out/share/hplip/fax/plugins/$plugin.so
+ done
+
+ mkdir -p $out/var/lib/hp
+ cp ${hplipState} $out/var/lib/hp/hplip.state
+ '';
+
+ # The installed executables are just symlinks into $out/share/hplip,
+ # but wrapPythonPrograms ignores symlinks. We cannot replace the Python
+ # modules in $out/share/hplip with wrapper scripts because they import
+ # each other as libraries. Instead, we emulate wrapPythonPrograms by
+ # 1. Calling patchPythonProgram on the original script in $out/share/hplip
+ # 2. Making our own wrapper pointing directly to the original script.
+ dontWrapPythonPrograms = true;
+ preFixup = ''
+ buildPythonPath "$out $pythonPath"
+
+ for bin in $out/bin/*; do
+ py=$(readlink -m $bin)
+ rm $bin
+ echo "patching \`$py'..."
+ patchPythonScript "$py"
+ echo "wrapping \`$bin'..."
+ makeWrapper "$py" "$bin" \
+ --prefix PATH ':' "$program_PATH" \
+ --set PYTHONNOUSERSITE "true" \
+ $makeWrapperArgs
+ done
+ '';
+
+ postFixup = ''
+ substituteInPlace $out/etc/hp/hplip.conf --replace /usr $out
+ # Patch udev rules:
+ # with plugin, they upload firmware to printers,
+ # without plugin, they complain about the missing plugin.
+ substituteInPlace $out/etc/udev/rules.d/56-hpmud.rules \
+ --replace {,${bash}}/bin/sh \
+ --replace /usr/bin/nohup "" \
+ --replace {,${util-linux}/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.
+ stripDebugList = [
+ "share/hplip" "lib/cups/backend" "lib/cups/filter" python3Packages.python.sitePackages "lib/sane"
+ ];
+
+ meta = with stdenv.lib; {
+ description = "Print, scan and fax HP drivers for Linux";
+ homepage = "https://developers.hp.com/hp-linux-imaging-and-printing";
+ downloadPage = "https://sourceforge.net/projects/hplip/files/hplip/";
+ license = if withPlugin
+ then licenses.unfree
+ else with licenses; [ mit bsd2 gpl2Plus ];
+ platforms = [ "i686-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" ];
+ maintainers = with maintainers; [ ttuegel ];
+ };
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/hplip.state b/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/hplip.state
new file mode 100644
index 000000000000..9d19a93f3644
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/hplip.state
@@ -0,0 +1,4 @@
+[plugin]
+installed=1
+eula=1
+version=@version@
diff --git a/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/image-processor.patch b/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/image-processor.patch
new file mode 100644
index 000000000000..30df1d29d97e
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/misc/drivers/hplip/image-processor.patch
@@ -0,0 +1,115 @@
+From 207aa582477dd874d1651db2d0654c5d6adb6e0a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
+Date: Fri, 20 Dec 2019 13:13:52 +0000
+Subject: [PATCH] remove imageprocessor
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
+---
+ Makefile.am | 4 ++--
+ Makefile.in | 2 +-
+ prnt/hpcups/HPCupsFilter.cpp | 19 -------------------
+ 3 files changed, 3 insertions(+), 22 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 891660d..484a051 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -166,7 +166,7 @@ if !HPLIP_CLASS_DRIVER
+ dist_hplip_SCRIPTS = hpssd.py __init__.py hpdio.py
+ endif #HPLIP_CLASS_DRIVER
+
+-dist_noinst_DATA += prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template prnt/hpcups/libImageProcessor-x86_64.so prnt/hpcups/libImageProcessor-x86_32.so
++dist_noinst_DATA += prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template
+ dist_noinst_SCRIPTS += dat2drv.py install.py hplip-install init-suse-firewall init-iptables-firewall class_rpm_build.sh hplipclassdriver.spec createPPD.sh Makefile_dat2drv hpijs-drv
+
+ if !HPLIP_CLASS_DRIVER
+@@ -594,7 +594,7 @@ hpcups_SOURCES = prnt/hpcups/HPCupsFilter.cpp prnt/hpcups/HPCupsFilter.h prnt/hp
+ prnt/hpcups/ImageProcessor.h
+
+ hpcups_CXXFLAGS = $(APDK_ENDIAN_FLAG) $(DBUS_CFLAGS)
+-hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lImageProcessor -lcups -lcupsimage -lz $(DBUS_LIBS)
++hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lcups -lcupsimage -lz $(DBUS_LIBS)
+ #else
+ #hpcupsdir = $(cupsfilterdir)
+ #hpcups_PROGRAMS = hpcups
+diff --git a/Makefile.in b/Makefile.in
+index 16c39f0..46a767e 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -4814,7 +4814,7 @@ libapdk_la_CFLAGS = $(libapdk_la_CXXFLAGS) -Iprnt/hpijs
+ @HPCUPS_INSTALL_TRUE@ prnt/hpcups/ImageProcessor.h
+
+ @HPCUPS_INSTALL_TRUE@hpcups_CXXFLAGS = $(APDK_ENDIAN_FLAG) $(DBUS_CFLAGS)
+-@HPCUPS_INSTALL_TRUE@hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lImageProcessor -lcups -lcupsimage -lz $(DBUS_LIBS)
++@HPCUPS_INSTALL_TRUE@hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lcups -lcupsimage -lz $(DBUS_LIBS)
+ #else
+ #hpcupsdir = $(cupsfilterdir)
+ #hpcups_PROGRAMS = hpcups
+diff --git a/prnt/hpcups/HPCupsFilter.cpp b/prnt/hpcups/HPCupsFilter.cpp
+index 5b282d8..153ee3a 100644
+--- a/prnt/hpcups/HPCupsFilter.cpp
++++ b/prnt/hpcups/HPCupsFilter.cpp
+@@ -31,7 +31,6 @@
+ \*****************************************************************************/
+
+ #include "HPCupsFilter.h"
+-#include "ImageProcessor.h"
+
+ #include <signal.h>
+ #include <sys/wait.h>
+@@ -637,16 +636,10 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+
+
+ sprintf(hpPreProcessedRasterFile, "%s/hp_%s_cups_SwapedPagesXXXXXX",CUPS_TMP_DIR, m_JA.user_name);
+- image_processor_t* imageProcessor = imageProcessorCreate();
+
+ while (cupsRasterReadHeader2(cups_raster, &cups_header))
+ {
+
+- IMAGE_PROCESSOR_ERROR result = imageProcessorStartPage(imageProcessor, &cups_header);
+- if (result != IPE_SUCCESS){
+- dbglog("DEBUG: imageProcessorStartPage failed result = %d\n", result);
+- }
+-
+ current_page_number++;
+
+ if (current_page_number == 1) {
+@@ -745,11 +738,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+ color_raster = rgbRaster;
+ black_raster = kRaster;
+
+- result = imageProcessorProcessLine(imageProcessor, m_pPrinterBuffer, cups_header.cupsBytesPerLine);
+- if (result != IPE_SUCCESS){
+- dbglog("DEBUG: imageProcessorProcessLine failed result = %d\n", result);
+- }
+-
+
+ if ((y == 0) && !is_ljmono) {
+ //For ljmono, make sure that first line is not a blankRaster line.Otherwise printer
+@@ -780,11 +768,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+ }
+ } // for() loop end
+
+- result = imageProcessorEndPage(imageProcessor);
+- if (result != IPE_SUCCESS){
+- dbglog("DEBUG: imageProcessorEndPage failed result = %d\n", result);
+- }
+-
+
+ m_Job.NewPage();
+ if (err != NO_ERROR) {
+@@ -800,8 +783,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+ rgbRaster = NULL;
+ }
+
+- imageProcessorDestroy(imageProcessor);
+-
+ unlink(hpPreProcessedRasterFile);
+ return ret_status;
+ }
+--
+2.24.1
+