Printing: Difference between revisions

imported>Zarelit
m use common lingo (many -> some)
imported>Wentasah
Client (Linux) - sometimes mdns4-only config is needed
Line 90: Line 90:
</syntaxhighlight>
</syntaxhighlight>


You also need the package <code>nssmdns</code>, otherwise CUPS errors with <code>Unable to locate printer **.local</code>.
If CUPS complains about "''Impossible to connect to XXX.local: Name or service not known''" even if {{nixos:option|services.avahi.nssmdns}} is enabled as shown above, the reason could be that mdns does not work properly with IPv6 in your network. In such a case, switching to mdns4-only setup can help:
 
<syntaxhighlight lang="nix">
CUPS also needs to be restarted after any boot. Make sure to try adding the printer several times because results vary a lot between runs.
{
  ...
  services.avahi.nssmdns = false; # Use the settings from below
  # settings from avahi-daemon.nix where mdns is replaced with mdns4
  system.nssModules = with pkgs.lib; optional (!config.services.avahi.nssmdns) pkgs.nssmdns;
  system.nssDatabases.hosts = with pkgs.lib; optionals (!config.services.avahi.nssmdns) (mkMerge [
    (mkOrder 900 [ "mdns4_minimal [NOTFOUND=return]" ]) # must be before resolve
    (mkOrder 1501 [ "mdns4" ]) # 1501 to ensure it's after dns
  ]);
}
</syntaxhighlight>
See [https://github.com/NixOS/nixpkgs/issues/118628 this bug report] for details.


===See also===
===See also===