Derivation for Java binary that uses "/usr/bin/lpr"?

I created a package for the PDF editor pdfstudio, which is essentially a Java binary. Everything works fine, except for printing. When I try to print, I get an error message, indicating that it’s trying to use /usr/bin/lpr, which (of course) doesn’t exist:

Caused by: java.io.IOException: Cannot run program “/usr/bin/lpr”: error=2, No such file or directory

Does anybody know how to work around that?

There are a couple of options.

  1. If this is open-source software that your derivation builds from source, you could replace /usr/bin/lpr in the source code with the actual path, e.g. ${pkgs.cups}/bin/lpr.
  2. If this is closed source software, i.e. your derivation packages a pre-made binary, you might need to package it as a FHS sandbox. See for example the lightworks derivation. You would need to include CUPS in targetPkgs, and that way the required binary would be at /usr/bin/lpr (from the application’s point of view), if I’m not mistaken.

If this is closed source software, i.e. your derivation packages a pre-made binary, you might need to package it as a FHS sandbox. See for example the lightworks derivation. You would need to include CUPS in targetPkgs , and that way the required binary would be at /usr/bin/lpr (from the application’s point of view), if I’m not mistaken.

This is exactly what I needed. Thank you!