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

Yarny0 eaa62fa3 ad47284f

+55
+53
pkgs/misc/cups/drivers/cups-drv-rastertosag-gdi/default.nix
··· 1 + { lib 2 + , fetchzip 3 + , fetchpatch 4 + , cups 5 + , python3Packages 6 + }: 7 + 8 + python3Packages.buildPythonApplication rec { 9 + pname = "rastertosag-gdi"; 10 + version = "0.1"; 11 + src = fetchzip { 12 + url = "https://www.openprinting.org/download/printing/${pname}/${pname}-${version}.tar.gz"; 13 + sha256 = "1ldplpv497j8vhw24sksg3fiw8c5pqr0wajajh7p5xpvb6zlcmvw"; 14 + }; 15 + patches = [ 16 + # port to python 3 17 + ( fetchpatch { 18 + url = "https://sources.debian.org/data/main/r/${pname}/0.1-7/debian/patches/0001-${pname}-python3.patch"; 19 + sha256 = "1l3xbrs67025595k9ba5794q3s74anizpbxwsshcfhmbrzd9h8hg"; 20 + }) 21 + ]; 22 + format = "other"; 23 + nativeBuildInputs = [ (lib.getBin cups) ]; 24 + # The source image also brings pre-built ppd files, 25 + # be we prefer to generate from source where possible, so 26 + # the following line generates ppd files from the drv file. 27 + postBuild = '' 28 + ppdc -v -d . -I "${cups}/share/cups/ppdc" rastertosag-gdi.drv 29 + ''; 30 + installPhase = '' 31 + runHook preInstall 32 + install -vDm 0644 -t "${placeholder "out"}/share/cups/model/rastertosag-gdi/" *.ppd 33 + install -vDm 0755 -t "${placeholder "out"}/bin/" rastertosag-gdi 34 + install -vd "${placeholder "out"}/lib/cups/filter/" 35 + ln -vst "${placeholder "out"}/lib/cups/filter/" "${placeholder "out"}/bin/rastertosag-gdi" 36 + runHook postInstall 37 + ''; 38 + meta = { 39 + description = "CUPS driver for Ricoh Aficio SP 1000S and SP 1100S printers"; 40 + downloadPage = "https://www.openprinting.org/download/printing/rastertosag-gdi/"; 41 + homepage = "https://www.openprinting.org/driver/rastertosag-gdi/"; 42 + license = lib.licenses.free; # just "GPL", according to README 43 + maintainers = [ lib.maintainers.yarny ]; 44 + longDescription = '' 45 + This package brings CUPS raster filter 46 + for Ricoh Aficio SP 1000S and SP 1100S. 47 + In contrast to other Ricoh laser printers, 48 + they use the proprietary SAG-GDI raster format by 49 + Sagem Communication and do not understand PCL or PostScript. 50 + Therefore they do not work with Ricoh's PPD files. 51 + ''; 52 + }; 53 + }
+2
pkgs/top-level/all-packages.nix
··· 29137 29137 29138 29138 cups-brother-hll2340dw = pkgsi686Linux.callPackage ../misc/cups/drivers/hll2340dw { }; 29139 29139 29140 + cups-drv-rastertosag-gdi = callPackage ../misc/cups/drivers/cups-drv-rastertosag-gdi { }; 29141 + 29140 29142 # this driver ships with pre-compiled 32-bit binary libraries 29141 29143 cnijfilter_2_80 = pkgsi686Linux.callPackage ../misc/cups/drivers/cnijfilter_2_80 { }; 29142 29144