Merge #313244: init `kyocera-ecosys-3500-4500` at 9.0

authored by nicoo and committed by GitHub cc427e0d decbe95b

+92
+6
maintainers/maintainer-list.nix
··· 13018 13018 githubId = 14259816; 13019 13019 name = "Abin Simon"; 13020 13020 }; 13021 + me-and = { 13022 + name = "Adam Dinwoodie"; 13023 + email = "nix.thunder.wayne@post.dinwoodie.org"; 13024 + github = "me-and"; 13025 + githubId = 1397507; 13026 + }; 13021 13027 meatcar = { 13022 13028 email = "nixpkgs@denys.me"; 13023 13029 github = "meatcar";
+86
pkgs/by-name/cu/cups-kyocera-3500-4500/package.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchzip 4 + , cups 5 + , autoPatchelfHook 6 + , python3Packages 7 + 8 + # Sets the default paper format: use "EU" for A4, or "Global" for Letter 9 + , region ? "EU" 10 + }: 11 + 12 + assert region == "Global" || region == "EU"; 13 + 14 + let 15 + kyodialog_version_short = "9"; 16 + kyodialog_version_long = "9.0"; 17 + date = "20221003"; 18 + in 19 + stdenv.mkDerivation rec { 20 + pname = "cups-kyocera-3500-4500"; 21 + version = "${kyodialog_version_long}-${date}"; 22 + 23 + dontStrip = true; 24 + 25 + src = fetchzip { 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 30 + urls = [ 31 + "https://dam.kyoceradocumentsolutions.com/content/dam/gdam_dc/dc_global/executables/driver/product_085/KyoceraLinuxPackages-${date}.tar.gz" 32 + ]; 33 + hash = "sha256-pqBtfKiQo/+cF8fG5vsEQvr8UdxjGsSShXI+6bun03c="; 34 + extension = "tar.gz"; 35 + stripRoot = false; 36 + postFetch = '' 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} 39 + ''; 40 + }; 41 + 42 + sourceRoot = "."; 43 + 44 + unpackCmd = let 45 + platforms = { 46 + x86_64-linux = "amd64"; 47 + i686-linux = "i386"; 48 + }; 49 + platform = platforms.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}"); 50 + in '' 51 + ar p "$src/Debian/${region}/kyodialog_${platform}/kyodialog_${kyodialog_version_long}-0_${platform}.deb" data.tar.gz | tar -xz 52 + ''; 53 + 54 + nativeBuildInputs = [ autoPatchelfHook python3Packages.wrapPython ]; 55 + 56 + buildInputs = [ cups ]; 57 + 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 ]; 61 + 62 + installPhase = '' 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 66 + 67 + # remove absolute path prefixes to filters in ppd 68 + find $out -name "*.ppd" -exec sed -E -i "s:/usr/lib/cups/filter/::g" {} \; 69 + 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" 74 + 75 + install -Dm444 usr/share/doc/kyodialog/copyright $out/share/doc/${pname}/copyright 76 + ''; 77 + 78 + meta = with lib; { 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" ]; 85 + }; 86 + }