13 , withNonfreeDb ? false # include foomatic-db-nonfree ppd files
17 foomatic-db-packages = [ foomatic-db ] ++
18 lib.lists.optional withNonfreeDb foomatic-db-nonfree;
20 foomatic-db-combined = buildEnv {
21 name = "foomatic-db-combined";
22 paths = foomatic-db-packages;
23 pathsToLink = [ "/share/foomatic" ];
24 # `foomatic-db-combined` is a nativeBuildInput of `foomatic-db-ppds`.
25 # The setup hook defined here helps scripts in
26 # `foomatic-db-engine` to find the database.
28 mkdir -p "${placeholder "out"}"/{etc/cups,nix-support}
29 cat >> "${placeholder "out"}/nix-support/setup-hook" << eof
30 export FOOMATICDB="${placeholder "out"}/share/foomatic"
35 # the effective license is `free` if all database
36 # packages have free licenses, `unfree` otherwise
37 isFree = lib.trivial.pipe foomatic-db-packages [
38 (lib.lists.map (lib.attrsets.attrByPath [ "meta" "license" ] lib.licenses.unfree))
39 (lib.lists.all (lib.attrsets.attrByPath [ "free" ] true))
44 pname = "foomatic-db-ppds";
45 # the effective version is simply the
46 # highest version of all database packages
47 version = lib.trivial.pipe foomatic-db-packages [
48 (lib.lists.map (lib.attrsets.getAttr "version"))
49 (lib.lists.sort lib.strings.versionOlder)
72 mkdir -p "${placeholder "out"}/share/cups/model"
73 foomatic-compiledb -j "$NIX_BUILD_CORES" -d "${placeholder "out"}/share/cups/model/foomatic-db-ppds"
77 # Comments indicate the respective
78 # package the command is contained in.
80 "cat" "echo" # coreutils
81 "foomatic-rip" # cups-filters or foomatic-filters
83 "pnmflip" "pnmgamma" "pnmnoraw" # netpbm
86 # These commands aren't packaged yet.
87 # ppd files using these likely won't work.
88 #"c2050" "c2070" "cjet" "lm1100"
89 #"pbm2l2030" "pbm2lwxl" "rastertophaser6100"
94 echo 'compressing ppd files'
95 find -H "${placeholder "out"}/share/cups/model/foomatic-db-ppds" -type f -iname '*.ppd' -print0 \
96 | xargs -0r -n 64 -P "$NIX_BUILD_CORES" gzip -9n
100 description = "OpenPrinting ppd files";
101 homepage = "https://openprinting.github.io/projects/02-foomatic/";
102 license = if isFree then lib.licenses.free else lib.licenses.unfree;
103 maintainers = [ lib.maintainers.yarny ];
104 # list printer manufacturers here so people
105 # searching for ppd files can find this package
107 All PPD files available in
108 OpenPrinting's Foomatic database.
109 This package contains about 8,800 PPD files,
111 Alps, Anitech, Apollo, Apple, Avery, Brother, Canon,
112 Citizen, CItoh, Compaq, DEC, Dell, Dymo-CoStar, Epson,
113 Fujitsu, FujiXerox, Generic, Genicom, Gestetner,
114 Heidelberg, Hitachi, HP, IBM, Imagen, Imagistics,
115 InfoPrint, Infotec, Kodak, KONICAMINOLTA, Kyocera, Lanier,
116 Lexmark, Minolta, MinoltaQMS, Mitsubishi, NEC, NRG, Oce,
117 Oki, Olivetti, Panasonic, PCPI, Pentax, QMS, Raven, Ricoh,
118 Samsung, Savin, Seiko, Sharp, SiPix, Sony, Star, Tally,
119 Tektronix, TexasInstruments, Toshiba, Xante and Xerox.