{ stdenv, lib, fetchurl, dpkg, autoPatchelfHook, cups, xorg, }: let debPlatform = if stdenv.hostPlatform.system == "x86_64-linux" then "x86_64" else if stdenv.hostPlatform.system == "i686-linux" then "i686" else throw "Unsupported system: ${stdenv.hostPlatform.system}"; in stdenv.mkDerivation rec { pname = "xerox-workcentre-7800-series-driver"; version = "5.20.661.4684"; debpkg = "XeroxOfficev5Pkg-Linux${debPlatform}-${version}.deb"; src = fetchurl { url = "https://download.support.xerox.com/pub/drivers/CQ8580/drivers/linux/pt_BR/${debpkg}"; sha256 = "014k0r9ij3401mnab1qzv96bjl9x7rf11aw1ibf0q370pk9jqqjb"; # TODO correct hash for i686 }; nativeBuildInputs = [ dpkg autoPatchelfHook ]; # TODO add support for disable xorg buildInputs = [ cups stdenv.cc.cc.lib xorg.libX11 xorg.libXrender xorg.libXfixes xorg.libXdamage xorg.libXcomposite xorg.libXcursor xorg.libXrandr xorg.libXext xorg.libXinerama ]; sourceRoot = "."; unpackCmd = "dpkg-deb -x $curSrc ."; dontConfigure = true; dontBuild = true; installPhase = '' runHook preInstall mkdir -p $out # Copy and patch the binaries and libraries cp -r opt $out/ cp -r usr $out/ # Move the PPD to CUPS model dir mkdir -p $out/share/cups/model cp opt/XeroxOffice/prtsys/ppd/*.ppd $out/share/cups/model/ # Install the CUPS filters mkdir -p $out/lib/cups/filter cp usr/lib/cups/filter/* $out/lib/cups/filter/ # Install man pages mkdir -p $out/share/man cp -r usr/share/man/* $out/share/man/ runHook postInstall ''; meta = with lib; { description = "Xerox WorkCentre 7800 Series Linux Printer Driver"; longDescription = '' WorkCentre 7830/7835/7845/7855 ''; homepage = "https://www.support.xerox.com/en-us/product/workcentre-7800-series/downloads?platform=linux"; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; #license = licenses.unfree; maintainers = []; platforms = platforms.linux; }; }