summary refs log tree commit diff
path: root/pkgs/misc/cups
diff options
context:
space:
mode:
authorStefan Junker <mail@stefanjunker.de>2018-04-26 00:16:26 +0200
committerStefan Junker <mail@stefanjunker.de>2018-04-26 00:24:37 +0200
commitc600f02e430b49c8907a63a12c62ee407b95cf5d (patch)
treef462cb814105891ea7b441ba3d9b29325b462a8e /pkgs/misc/cups
parent2665e3ec2878aa67361befcb0bcba74211b1f0a3 (diff)
downloadnixlib-c600f02e430b49c8907a63a12c62ee407b95cf5d.tar
nixlib-c600f02e430b49c8907a63a12c62ee407b95cf5d.tar.gz
nixlib-c600f02e430b49c8907a63a12c62ee407b95cf5d.tar.bz2
nixlib-c600f02e430b49c8907a63a12c62ee407b95cf5d.tar.lz
nixlib-c600f02e430b49c8907a63a12c62ee407b95cf5d.tar.xz
nixlib-c600f02e430b49c8907a63a12c62ee407b95cf5d.tar.zst
nixlib-c600f02e430b49c8907a63a12c62ee407b95cf5d.zip
cups-kyodialog3: init at 8.1601
Diffstat (limited to 'pkgs/misc/cups')
-rw-r--r--pkgs/misc/cups/drivers/kyodialog3/default.nix65
1 files changed, 65 insertions, 0 deletions
diff --git a/pkgs/misc/cups/drivers/kyodialog3/default.nix b/pkgs/misc/cups/drivers/kyodialog3/default.nix
new file mode 100644
index 000000000000..bc48b2c8f339
--- /dev/null
+++ b/pkgs/misc/cups/drivers/kyodialog3/default.nix
@@ -0,0 +1,65 @@
+{ stdenv, lib, fetchzip, cups
+
+  # Can either be "EU" or "Global"; it's unclear what the difference is
+  , region ? "Global"
+}:
+
+let
+  platform =
+    if stdenv.system == "x86_64-linux" then "64bit"
+    else if stdenv.system == "i686-linux" then "32bit"
+         else throw "Unsupported system: ${stdenv.system}";
+  debPlatform = 
+    if platform == "64bit" then "amd64"
+    else "i386";
+  debRegion = if region == "EU" then "EU." else "";
+
+  # TODO: add Qt4 for kyodialog3 application
+  libPath = lib.makeLibraryPath [ cups ];
+in
+stdenv.mkDerivation rec {
+  name = "cups-kyodialog3-${version}";
+  version = "8.1601";
+
+  dontPatchELF = true;
+  dontStrip = true;
+
+  src = fetchzip {
+    url = "https://usa.kyoceradocumentsolutions.com/content/dam/kdc/kdag/downloads/technical/executables/drivers/kyoceradocumentsolutions/us/en/Kyocera_Linux_PPD_Ver_${version}.tar.gz";
+    sha256 = "11znnlkfssakml7w80gxlz1k59f3nvhph91fkzzadnm9i7a8yjal";
+  };
+
+  installPhase = ''
+    mkdir -p $out
+    cd $out
+
+    # unpack the debian archive
+    ar p ${src}/KyoceraLinuxPackages/${region}/${platform}/kyodialog3.en${debRegion}_0.5-0_${debPlatform}.deb data.tar.gz | tar -xz
+    rm -Rf KyoceraLinuxPackages
+
+    # strip $out/usr
+    mv usr/* .
+    rmdir usr
+
+    # allow cups to find the ppd files
+    mkdir -p share/cups/model
+    mv share/ppd/kyocera share/cups/model/Kyocera
+    rmdir share/ppd
+
+    # prepend $out to all references in ppd and desktop files
+    find -name "*.ppd" -exec sed -E -i "s:/usr/lib:$out/lib:g" {} \;
+    find -name "*.desktop" -exec sed -E -i "s:/usr/lib:$out/lib:g" {} \;
+
+    # patchELF all executables
+    find -type f -executable -exec patchelf --set-rpath ${libPath} --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) {} \;
+  '';
+
+  meta = with lib; {
+    description = "CUPS drivers for several Kyocera printers";
+    homepage = "https://www.kyoceradocumentsolutions.com";
+    license = licenses.unfree;
+    maintainers = [ maintainers.steveej ];
+    platforms = platforms.linux;
+  };
+
+}