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 # Where there's no version encoded in the vendor URL, prefer a
32 # web.archive.org URL. That means that if the vendor updates the package
33 # at this URL, the package won't suddenly stop building.
35 "https://web.archive.org/web/20241123173620/https://www.kyoceradocumentsolutions.us/content/download-center-americas/us/drivers/drivers/MA_PA_4500ci_Linux_gz.download.gz"
36 "https://www.kyoceradocumentsolutions.us/content/download-center-americas/us/drivers/drivers/MA_PA_4500ci_Linux_gz.download.gz"
38 hash = "sha256-pqBtfKiQo/+cF8fG5vsEQvr8UdxjGsSShXI+6bun03c=";
40 downloadToTemp = true;
42 unpackDir="$TMPDIR/unpack"
46 mv "$downloadedFile" "$TMPDIR/source.tar.gz.gz"
47 gunzip "$TMPDIR/source.tar.gz.gz"
48 unpackFile "$TMPDIR/source.tar.gz"
49 chmod -R +w "$unpackDir"
50 mv "$unpackDir" "$out"
52 # delete redundant Linux package dirs to reduce size in the Nix store; only keep Debian
53 rm -r $out/{CentOS,Fedora,OpenSUSE,Redhat,Ubuntu}
61 x86_64-linux = "amd64";
64 platform = platforms.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}");
66 ar p "$src/Debian/${region}/kyodialog_${platform}/kyodialog_${kyodialog_version_long}-0_${platform}.deb" data.tar.gz | tar -xz
69 nativeBuildInputs = [ autoPatchelfHook python3Packages.wrapPython ];
71 buildInputs = [ cups ];
73 # For lib/cups/filter/kyofilter_pre_H.
74 # The source already contains a copy of pypdf3, but we use the Nix package
75 propagatedBuildInputs = with python3Packages; [ reportlab pypdf3 setuptools ];
78 # allow cups to find the ppd files
79 mkdir -p $out/share/cups/model
80 mv ./usr/share/kyocera${kyodialog_version_short}/ppd${kyodialog_version_short} $out/share/cups/model/Kyocera
82 # remove absolute path prefixes to filters in ppd
83 find $out -name "*.ppd" -exec sed -E -i "s:/usr/lib/cups/filter/::g" {} \;
85 mkdir -p $out/lib/cups/
86 mv ./usr/lib/cups/filter/ $out/lib/cups/
87 # for lib/cups/filter/kyofilter_pre_H
88 wrapPythonProgramsIn $out/lib/cups/filter "$propagatedBuildInputs"
90 install -Dm444 usr/share/doc/kyodialog/copyright $out/share/doc/cups-kyocera-3500-4500/copyright
94 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";
95 homepage = "https://www.kyoceradocumentsolutions.com";
96 sourceProvenance = [ sourceTypes.binaryNativeCode ];
97 license = licenses.unfree;
98 maintainers = [ maintainers.me-and ];
99 platforms = [ "i686-linux" "x86_64-linux" ];