8 # Sets the default paper format: use "EU" for A4, or "Global" for Letter
12 assert region == "Global" || region == "EU";
15 kyodialog_version_short = "9";
16 kyodialog_version_long = "9.0";
19 stdenv.mkDerivation rec {
20 pname = "cups-kyocera-3500-4500";
21 version = "${kyodialog_version_long}-${date}";
26 # Steps to find the release download URL:
27 # 1. Go to https://www.kyoceradocumentsolutions.us/en/support/downloads.html
28 # 2. Search for printer model, e.g. "TASKalfa 6053ci"
29 # 3. Locate e.g. "Linux Print Driver (9.3)" in the list
31 "https://dam.kyoceradocumentsolutions.com/content/dam/gdam_dc/dc_global/executables/driver/product_085/KyoceraLinuxPackages-${date}.tar.gz"
33 hash = "sha256-pqBtfKiQo/+cF8fG5vsEQvr8UdxjGsSShXI+6bun03c=";
37 # delete redundant Linux package dirs to reduce size in the Nix store; only keep Debian
38 rm -r $out/{CentOS,Fedora,OpenSUSE,Redhat,Ubuntu}
46 x86_64-linux = "amd64";
49 platform = platforms.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}");
51 ar p "$src/Debian/${region}/kyodialog_${platform}/kyodialog_${kyodialog_version_long}-0_${platform}.deb" data.tar.gz | tar -xz
54 nativeBuildInputs = [ autoPatchelfHook python3Packages.wrapPython ];
56 buildInputs = [ cups ];
58 # For lib/cups/filter/kyofilter_pre_H.
59 # The source already contains a copy of pypdf3, but we use the Nix package
60 propagatedBuildInputs = with python3Packages; [ reportlab pypdf3 setuptools ];
63 # allow cups to find the ppd files
64 mkdir -p $out/share/cups/model
65 mv ./usr/share/kyocera${kyodialog_version_short}/ppd${kyodialog_version_short} $out/share/cups/model/Kyocera
67 # remove absolute path prefixes to filters in ppd
68 find $out -name "*.ppd" -exec sed -E -i "s:/usr/lib/cups/filter/::g" {} \;
70 mkdir -p $out/lib/cups/
71 mv ./usr/lib/cups/filter/ $out/lib/cups/
72 # for lib/cups/filter/kyofilter_pre_H
73 wrapPythonProgramsIn $out/lib/cups/filter "$propagatedBuildInputs"
75 install -Dm444 usr/share/doc/kyodialog/copyright $out/share/doc/cups-kyocera-3500-4500/copyright
79 description = "CUPS drivers for Kyocera ECOSYS MA3500cix, MA3500cifx, MA4000cix, MA4000cifx, PA3500cx, PA4000cx and PA4500cx, for Kyocera CS MA4500ci and PA4500ci, and for Kyocera TASKalfa MA3500ci, MA4500ci and PI4500ci printers";
80 homepage = "https://www.kyoceradocumentsolutions.com";
81 sourceProvenance = [ sourceTypes.binaryNativeCode ];
82 license = licenses.unfree;
83 maintainers = [ maintainers.me-and ];
84 platforms = [ "i686-linux" "x86_64-linux" ];