4 , withCupsAccess ? false # needed to access local cups server
8 , withSocketAccess ? false # needed to access network printers
10 , withSMBAccess ? false # needed to access SMB-connected printers
18 perlPackages.buildPerlPackage rec {
19 pname = "foomatic-db-engine";
20 version = "unstable-2024-02-10";
22 src = fetchFromGitHub {
23 # there is also a daily snapshot at the `downloadPage`,
24 # but it gets deleted quickly and would provoke 404 errors
25 owner = "OpenPrinting";
26 repo = "foomatic-db-engine";
27 rev = "a2b12271e145fe3fd34c3560d276a57e928296cb";
28 hash = "sha256-qM12qtGotf9C0cjO9IkmzlW9GWCkT2Um+6dU3mZm3DU=";
33 propagatedBuildInputs = [
36 perlPackages.XMLLibXML
41 # provide some "cups-*" commands to `foomatic-{configure,printjob}`
42 # so that they can manage a local cups server (add queues, add jobs...)
43 ++ lib.optionals withCupsAccess [ cups cups-filters ]
44 # the commands `foomatic-{configure,getpjloptions}` need
45 # netcat if they are used to query or alter a network
46 # printer via AppSocket/HP JetDirect protocol
47 ++ lib.optional withSocketAccess netcat-gnu
48 # `foomatic-configure` can be used to access printers that are
49 # shared via the SMB protocol, but it needs the `smbclient` binary
50 ++ lib.optional withSMBAccess samba
53 nativeBuildInputs = [ autoconf automake file makeWrapper ];
55 # sed-substitute indirection is more robust against
56 # characters in paths that might need escaping
58 sed -Ei 's|^(S?BINSEARCHPATH=).+$|\1"@PATH@"|g' configure.ac
59 substituteInPlace configure.ac --subst-var PATH
60 touch Makefile.PL # `buildPerlPackage` fails unless this exists
68 "--sysconfdir=${placeholder "out"}/etc"
69 "LIBDIR=${placeholder "out"}/share/foomatic"
70 "PERLPREFIX=${placeholder "out"}"
74 for bin in "${placeholder "out"}/bin"/*; do
75 test '!' -L "$bin" || continue # skip symlink
76 wrapProgram "$bin" --set PERL5LIB "$PERL5LIB"
80 doCheck = false; # no tests, would fail
83 changelog = "https://github.com/OpenPrinting/foomatic-db-engine/blob/${src.rev}/ChangeLog";
84 description = "OpenPrinting printer support database engine";
85 downloadPage = "https://www.openprinting.org/download/foomatic/";
86 homepage = "https://openprinting.github.io/projects/02-foomatic/";
87 license = lib.licenses.gpl2Only;
88 maintainers = [ lib.maintainers.yarny ];
90 Foomatic's database engine generates PPD files
91 from the data in Foomatic's XML database.
92 It also contains scripts to directly
93 generate print queues and handle jobs.