Printing: Difference between revisions
imported>Onny Further cleanup |
imported>Onny Further cleanup |
||
| Line 45: | Line 45: | ||
Search for other printer drivers in the NixOS package directory: the official list of packages is [https://search.nixos.org/packages here]. Add the driver to {{nixos:option|services.printing.drivers}}, '''not''' {{nixos:option|environment.systemPackages}}. | Search for other printer drivers in the NixOS package directory: the official list of packages is [https://search.nixos.org/packages here]. Add the driver to {{nixos:option|services.printing.drivers}}, '''not''' {{nixos:option|environment.systemPackages}}. | ||
==== With a raw PPD ==== | ==== With a raw PPD ==== | ||
| Line 145: | Line 104: | ||
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). | ||
=== 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. | |||
=== Printer sharing === | |||
Enable network sharing of the default local printer. Note that <code>listenAddresses = [ "*:631" ];</code> and <code>allowFrom = [ "all" ];</code> will enable anonymous access to your printer on all interfaces, you might want to restrict this. | |||
<syntaxhighlight lang="nix"> | |||
services.avahi = { | |||
enable = true; | |||
nssmdns = true; | |||
openFirewall = true; | |||
publish = { | |||
enable = true; | |||
userServices = true; | |||
}; | |||
}; | |||
services.printing = { | |||
listenAddresses = [ "*:631" ]; | |||
allowFrom = [ "all" ]; | |||
browsing = true; | |||
defaultShared = true; | |||
}; | |||
networking.firewall = { | |||
allowedTCPPorts = [ 631 ]; | |||
allowedUDPPorts = [ 631 ]; | |||
}; | |||
</syntaxhighlight> | |||
Once printer sharing is enabled, it could be additionally advertised in the home network via the Samba protocol, [[Samba#Printer_sharing|see]]. | |||
== Troubleshooting == | == Troubleshooting == | ||