about summary refs log tree commit diff
diff options
context:
space:
mode:
authornicoo <nicoo@debian.org>2024-05-22 21:59:12 +0000
committerGitHub <noreply@github.com>2024-05-22 21:59:12 +0000
commitcc427e0d2adda82efe9f959b55dad27f366016d1 (patch)
tree3efc5b200b264980308e0ea60949b03596d99a82
parentdecbe95bda72743fa93fd9eedf8b77d7b30a5d75 (diff)
parentf2790d475ac3d6e51424dd503cbeeb7ebeb30b48 (diff)
Merge #313244: init `kyocera-ecosys-3500-4500` at 9.0
-rw-r--r--maintainers/maintainer-list.nix6
-rw-r--r--pkgs/by-name/cu/cups-kyocera-3500-4500/package.nix86
2 files changed, 92 insertions, 0 deletions
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 1409fb743964c..a6cabb0d840cd 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -13018,6 +13018,12 @@
     githubId = 14259816;
     name = "Abin Simon";
   };
+  me-and = {
+    name = "Adam Dinwoodie";
+    email = "nix.thunder.wayne@post.dinwoodie.org";
+    github = "me-and";
+    githubId = 1397507;
+  };
   meatcar = {
     email = "nixpkgs@denys.me";
     github = "meatcar";
diff --git a/pkgs/by-name/cu/cups-kyocera-3500-4500/package.nix b/pkgs/by-name/cu/cups-kyocera-3500-4500/package.nix
new file mode 100644
index 0000000000000..14f89056daf93
--- /dev/null
+++ b/pkgs/by-name/cu/cups-kyocera-3500-4500/package.nix
@@ -0,0 +1,86 @@
+{ lib
+, stdenv
+, fetchzip
+, cups
+, autoPatchelfHook
+, python3Packages
+
+# Sets the default paper format: use "EU" for A4, or "Global" for Letter
+, region ? "EU"
+}:
+
+assert region == "Global" || region == "EU";
+
+let
+  kyodialog_version_short = "9";
+  kyodialog_version_long = "9.0";
+  date = "20221003";
+in
+stdenv.mkDerivation rec {
+  pname = "cups-kyocera-3500-4500";
+  version = "${kyodialog_version_long}-${date}";
+
+  dontStrip = true;
+
+  src = fetchzip {
+    # Steps to find the release download URL:
+    # 1. Go to https://www.kyoceradocumentsolutions.us/en/support/downloads.html
+    # 2. Search for printer model, e.g. "TASKalfa 6053ci"
+    # 3. Locate e.g. "Linux Print Driver (9.3)" in the list
+    urls = [
+      "https://dam.kyoceradocumentsolutions.com/content/dam/gdam_dc/dc_global/executables/driver/product_085/KyoceraLinuxPackages-${date}.tar.gz"
+    ];
+    hash = "sha256-pqBtfKiQo/+cF8fG5vsEQvr8UdxjGsSShXI+6bun03c=";
+    extension = "tar.gz";
+    stripRoot = false;
+    postFetch = ''
+      # delete redundant Linux package dirs to reduce size in the Nix store; only keep Debian
+      rm -r $out/{CentOS,Fedora,OpenSUSE,Redhat,Ubuntu}
+    '';
+  };
+
+  sourceRoot = ".";
+
+  unpackCmd = let
+    platforms = {
+      x86_64-linux = "amd64";
+      i686-linux = "i386";
+    };
+    platform = platforms.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}");
+  in ''
+    ar p "$src/Debian/${region}/kyodialog_${platform}/kyodialog_${kyodialog_version_long}-0_${platform}.deb" data.tar.gz | tar -xz
+  '';
+
+  nativeBuildInputs = [ autoPatchelfHook python3Packages.wrapPython ];
+
+  buildInputs = [ cups ];
+
+  # For lib/cups/filter/kyofilter_pre_H.
+  # The source already contains a copy of pypdf3, but we use the Nix package
+  propagatedBuildInputs = with python3Packages; [ reportlab pypdf3 setuptools ];
+
+  installPhase = ''
+    # allow cups to find the ppd files
+    mkdir -p $out/share/cups/model
+    mv ./usr/share/kyocera${kyodialog_version_short}/ppd${kyodialog_version_short} $out/share/cups/model/Kyocera
+
+    # remove absolute path prefixes to filters in ppd
+    find $out -name "*.ppd" -exec sed -E -i "s:/usr/lib/cups/filter/::g" {} \;
+
+    mkdir -p $out/lib/cups/
+    mv ./usr/lib/cups/filter/ $out/lib/cups/
+    # for lib/cups/filter/kyofilter_pre_H
+    wrapPythonProgramsIn $out/lib/cups/filter "$propagatedBuildInputs"
+
+    install -Dm444 usr/share/doc/kyodialog/copyright $out/share/doc/${pname}/copyright
+  '';
+
+  meta = with lib; {
+    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";
+    homepage = "https://www.kyoceradocumentsolutions.com";
+    sourceProvenance = [ sourceTypes.binaryNativeCode ];
+    license = licenses.unfree;
+    maintainers = [ maintainers.me-and ];
+    platforms = [ "i686-linux" "x86_64-linux" ];
+  };
+}