Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 105 lines 3.0 kB view raw
1{ 2 lib, 3 perlPackages, 4 fetchFromGitHub, 5 withCupsAccess ? false, # needed to access local cups server 6 cups, 7 cups-filters, 8 curl, 9 withSocketAccess ? false, # needed to access network printers 10 netcat-gnu, 11 withSMBAccess ? false, # needed to access SMB-connected printers 12 samba, 13 autoconf, 14 automake, 15 file, 16 makeWrapper, 17}: 18 19perlPackages.buildPerlPackage rec { 20 pname = "foomatic-db-engine"; 21 version = "0-unstable-2024-02-10"; 22 23 src = fetchFromGitHub { 24 # there is also a daily snapshot at the `downloadPage`, 25 # but it gets deleted quickly and would provoke 404 errors 26 owner = "OpenPrinting"; 27 repo = "foomatic-db-engine"; 28 rev = "a2b12271e145fe3fd34c3560d276a57e928296cb"; 29 hash = "sha256-qM12qtGotf9C0cjO9IkmzlW9GWCkT2Um+6dU3mZm3DU="; 30 }; 31 32 outputs = [ "out" ]; 33 34 propagatedBuildInputs = [ 35 perlPackages.Clone 36 perlPackages.DBI 37 perlPackages.XMLLibXML 38 ]; 39 40 buildInputs = [ 41 curl 42 ] 43 # provide some "cups-*" commands to `foomatic-{configure,printjob}` 44 # so that they can manage a local cups server (add queues, add jobs...) 45 ++ lib.optionals withCupsAccess [ 46 cups 47 cups-filters 48 ] 49 # the commands `foomatic-{configure,getpjloptions}` need 50 # netcat if they are used to query or alter a network 51 # printer via AppSocket/HP JetDirect protocol 52 ++ lib.optional withSocketAccess netcat-gnu 53 # `foomatic-configure` can be used to access printers that are 54 # shared via the SMB protocol, but it needs the `smbclient` binary 55 ++ lib.optional withSMBAccess samba; 56 57 nativeBuildInputs = [ 58 autoconf 59 automake 60 file 61 makeWrapper 62 ]; 63 64 # sed-substitute indirection is more robust against 65 # characters in paths that might need escaping 66 prePatch = '' 67 sed -Ei 's|^(S?BINSEARCHPATH=).+$|\1"@PATH@"|g' configure.ac 68 substituteInPlace configure.ac --subst-var PATH 69 touch Makefile.PL # `buildPerlPackage` fails unless this exists 70 ''; 71 72 preConfigure = '' 73 ./make_configure 74 ''; 75 76 configureFlags = [ 77 "--sysconfdir=${placeholder "out"}/etc" 78 "LIBDIR=${placeholder "out"}/share/foomatic" 79 "PERLPREFIX=${placeholder "out"}" 80 ]; 81 82 postFixup = '' 83 for bin in "${placeholder "out"}/bin"/*; do 84 test '!' -L "$bin" || continue # skip symlink 85 wrapProgram "$bin" --set PERL5LIB "$PERL5LIB" 86 done 87 ''; 88 89 doCheck = false; # no tests, would fail 90 91 meta = { 92 changelog = "https://github.com/OpenPrinting/foomatic-db-engine/blob/${src.rev}/ChangeLog"; 93 description = "OpenPrinting printer support database engine"; 94 downloadPage = "https://www.openprinting.org/download/foomatic/"; 95 homepage = "https://openprinting.github.io/projects/02-foomatic/"; 96 license = lib.licenses.gpl2Only; 97 maintainers = [ lib.maintainers.yarny ]; 98 longDescription = '' 99 Foomatic's database engine generates PPD files 100 from the data in Foomatic's XML database. 101 It also contains scripts to directly 102 generate print queues and handle jobs. 103 ''; 104 }; 105}