summary refs log tree commit diff
path: root/pkgs/misc
diff options
context:
space:
mode:
authorYarny0 <41838844+Yarny0@users.noreply.github.com>2021-03-31 20:49:14 +0200
committerYarny0 <41838844+Yarny0@users.noreply.github.com>2021-04-02 10:51:36 +0200
commiteaa62fa391e70fec75ec75f802c16e78b0adfa81 (patch)
treec582470a1b22efb57f6d72f59daed468504c5daa /pkgs/misc
parentad47284f8b01f587e24a4f14e0f93126d8ebecda (diff)
downloadnixpkgs-eaa62fa391e70fec75ec75f802c16e78b0adfa81.tar
nixpkgs-eaa62fa391e70fec75ec75f802c16e78b0adfa81.tar.gz
nixpkgs-eaa62fa391e70fec75ec75f802c16e78b0adfa81.tar.bz2
nixpkgs-eaa62fa391e70fec75ec75f802c16e78b0adfa81.tar.lz
nixpkgs-eaa62fa391e70fec75ec75f802c16e78b0adfa81.tar.xz
nixpkgs-eaa62fa391e70fec75ec75f802c16e78b0adfa81.tar.zst
nixpkgs-eaa62fa391e70fec75ec75f802c16e78b0adfa81.zip
rastertosag-gdi (cups driver): init at 0.1
Some Ricoh printers use the proprietary sag-gdi format
and can't handle other, more common formats.
This commit brings a filter for cups
that generates the sag-gdi format.

The latest version 0.1 is dated 2011.  So updates are unlikely.

The filter is written for Python 2.
To avoid new reverse dependencies on Python 2,
we employ a patch from Debian
that migrates the code to Python 3.

The README file just states "GPL" as license.
It is unclear whether that refers to the first version or
to the "current version" in the year of the copyright
(would be 3), and whether newer versions would be included.
The commit picks the nixpkgs `free` license
as this seems to be the most general license
covering all possible GPL combinations.
At least, `free` should permit Hydra to build the package.

The source tarball brings pdd files, but also a
drv file that can be used to generate those ppd files.
Since we prefer building from source,
we call cups' `ppdc` to build ppd files from the drv file.

Here is a documentation of the sag-gdi format:
https://www.undocprint.org/formats/page_description_languages/sagem-gdi
Diffstat (limited to 'pkgs/misc')
-rw-r--r--pkgs/misc/cups/drivers/cups-drv-rastertosag-gdi/default.nix53
1 files changed, 53 insertions, 0 deletions
diff --git a/pkgs/misc/cups/drivers/cups-drv-rastertosag-gdi/default.nix b/pkgs/misc/cups/drivers/cups-drv-rastertosag-gdi/default.nix
new file mode 100644
index 00000000000..d4914365545
--- /dev/null
+++ b/pkgs/misc/cups/drivers/cups-drv-rastertosag-gdi/default.nix
@@ -0,0 +1,53 @@
+{ lib
+, fetchzip
+, fetchpatch
+, cups
+, python3Packages
+}:
+
+python3Packages.buildPythonApplication rec {
+  pname = "rastertosag-gdi";
+  version = "0.1";
+  src = fetchzip {
+    url = "https://www.openprinting.org/download/printing/${pname}/${pname}-${version}.tar.gz";
+    sha256 = "1ldplpv497j8vhw24sksg3fiw8c5pqr0wajajh7p5xpvb6zlcmvw";
+  };
+  patches = [
+    # port to python 3
+    ( fetchpatch {
+      url = "https://sources.debian.org/data/main/r/${pname}/0.1-7/debian/patches/0001-${pname}-python3.patch";
+      sha256 = "1l3xbrs67025595k9ba5794q3s74anizpbxwsshcfhmbrzd9h8hg";
+    })
+  ];
+  format = "other";
+  nativeBuildInputs = [ (lib.getBin cups) ];
+  # The source image also brings pre-built ppd files,
+  # be we prefer to generate from source where possible, so
+  # the following line generates ppd files from the drv file.
+  postBuild = ''
+    ppdc -v -d . -I "${cups}/share/cups/ppdc" rastertosag-gdi.drv
+  '';
+  installPhase = ''
+    runHook preInstall
+    install -vDm 0644 -t "${placeholder "out"}/share/cups/model/rastertosag-gdi/" *.ppd
+    install -vDm 0755 -t "${placeholder "out"}/bin/" rastertosag-gdi
+    install -vd "${placeholder "out"}/lib/cups/filter/"
+    ln -vst "${placeholder "out"}/lib/cups/filter/" "${placeholder "out"}/bin/rastertosag-gdi"
+    runHook postInstall
+  '';
+  meta = {
+    description = "CUPS driver for Ricoh Aficio SP 1000S and SP 1100S printers";
+    downloadPage = "https://www.openprinting.org/download/printing/rastertosag-gdi/";
+    homepage = "https://www.openprinting.org/driver/rastertosag-gdi/";
+    license = lib.licenses.free;  # just "GPL", according to README
+    maintainers = [ lib.maintainers.yarny ];
+    longDescription = ''
+      This package brings CUPS raster filter
+      for Ricoh Aficio SP 1000S and SP 1100S.
+      In contrast to other Ricoh laser printers,
+      they use the proprietary SAG-GDI raster format by
+      Sagem Communication and do not understand PCL or PostScript.
+      Therefore they do not work with Ricoh's PPD files.
+    '';
+  };
+}