Printing: Difference between revisions
imported>Onny First work on major cleanup of the page |
imported>Onny Further cleanup |
||
| Line 11: | Line 11: | ||
== Usage == | == Usage == | ||
After enabling the printing service you'll be able to configure and add network printers via http://localhost:631. | After enabling the printing service you'll be able to configure and add network printers via http://localhost:631. You may need to authenticate with your local user when you add the printer. | ||
Depending on your desktop environment, there are several graphical tools available which will connect to this backend service and allow you a more convenient printer management. | Depending on your desktop environment, there are several graphical tools available which will connect to this backend service and allow you a more convenient printer management, for example <code>system-config-printer</code>. | ||
== Configuration == | == Configuration == | ||
=== | === Adding printers === | ||
Beside manually adding printers with client tools, it is possible to permanently add printers to your system configuration: | |||
<syntaxhighlight lang="nix"> | |||
services.printing.enable = true; | |||
services. | </syntaxhighlight> | ||
</ | |||
Some local or network printers might need additional drivers. You can add them using the <code>drivers</code> option | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
services.printing.drivers = [ YOUR_DRIVER ]; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
where <code>YOUR_DRIVER</code> is the driver package appropriate for your printer. Commonly used driver packages include: | where <code>YOUR_DRIVER</code> is the driver package appropriate for your printer. Commonly used driver packages include: | ||
| Line 58: | Line 46: | ||
* Search for other printer drivers in the NixOS package directory: the official list of packages is [https://search.nixos.org/packages here] but does not list unfree packages (which is the case of many printer drivers). To list unfree packages, see [[FAQ#How_can_I_install_a_proprietary_or_unfree_package.3F|The appropriate FAQ entry for installing unfree packages.]] | * Search for other printer drivers in the NixOS package directory: the official list of packages is [https://search.nixos.org/packages here] but does not list unfree packages (which is the case of many printer drivers). To list unfree packages, see [[FAQ#How_can_I_install_a_proprietary_or_unfree_package.3F|The appropriate FAQ entry for installing unfree packages.]] | ||
Add the driver to {{nixos:option|services.printing.drivers}}, '''not''' {{nixos:option|environment.systemPackages}}. | |||
=== Enable autodiscovery of network printers === | |||
Most printers manufactured after 2013 support the [https://www.pwg.org/ipp/everywhere.html IPP Everywhere] protocol, i.e. printing without installing drivers. This is notably the case of all WiFi printers marketed as Apple-compatible ([https://support.apple.com/en-ca/HT201311 list]). | |||
To detect these printers, add the following to your system configuration: | |||
<syntaxhighlight lang="nix"> | |||
services.avahi = { | |||
enable = true; | |||
nssmdns = true; | |||
openFirewall = true; | |||
} | |||
</syntaxhighlight> | |||
Discovery is done via the opened UDP port <code>5353</code>. Printers should get automatically detected and visible in your printer configuration client. | |||
==== With a raw PPD ==== | ==== With a raw PPD ==== | ||
| Line 124: | Line 121: | ||
For debugging purpose, it may be interesting to note that the data folder used by cups (containing the drivers and more) can be obtained by looking in the environment <code>$CUPS_DATADIR</code> (the contents of <code>$out/share/cups/</code> contained in your drivers are linked in this folder). | For debugging purpose, it may be interesting to note that the data folder used by cups (containing the drivers and more) can be obtained by looking in the environment <code>$CUPS_DATADIR</code> (the contents of <code>$out/share/cups/</code> contained in your drivers are linked in this folder). | ||
==Setting up shared printers== | ==Setting up shared printers== | ||