Printers...they work

so, that last i set up a printer with linux it was a f**king nightmare.

So id’ thought i’d give Nixos try

  services.printing.enable = true;
  services.printing.drivers = [ pkgs.gutenprint ];

and configured cups at https

it found both my printers, configured them, i was printing under 5 mins.

How is this possible?

5 Likes

Magic :tada:

Or more specifically this magic: https://github.com/NixOS/nixpkgs/blob/c2038731e46abd56d5c6430bd5a13d622c5a4e4d/nixos/modules/services/printing/cupsd.nix

This loads the drivers and makes it so cups can find it.

Also if you have a wifi printer you can also go above and beyond with this

services.printing.browsing = true;
services.printing.browsedConf = ''
BrowseDNSSDSubTypes _cups,_print
BrowseLocalProtocols all
BrowseRemoteProtocols all
CreateIPPPrinterQueues All

BrowseProtocols all
    '';
services.avahi = {
  enable = true;
  nssmdns = true;
};

Which will automatically find and configure your printer, no setup required.

2 Likes

must of missed this off the wiki! thanks!

Can I ask a related question here. I posted elsewhere, but haven’t received a response yet.

My setup looks like this:

services.printing = {
  enable = true;
  drivers = with pkgs; [ gutenprint canon-cups-ufr2 cups-filters ];
}
services.avahi = {
  enable = true;
  nssmdns = true;
};

Cups finds the printer share and connects to it, but when I try printing to it, I get:

Use "pdftops-renderer" option (see cups-filters README file) to use Ghostscript or MuPDF for the PDF -> PostScript conversion.

Any thoughts?

Use “IPP Everywhere” if you can: Brother DCP-572DW wrapper - #3 by peterhoeg

2 Likes

Probably Printing - NixOS Wiki needs updating.

I was going to do it sunday, but i had a blocked pipeline that was backed up with s**t. Not the greatest job and a bit of a time ‘sink’.

Can cups itself be totally declarative, rather than a manual procedure… I know some universities that would kill for this, as they usually have *LOTS’ of printers!!!

Refer to my linked post. That’s a fully declarative printer config.

1 Like

Ah, serves me right for trying to do 20 things at once, great link.

My (brain) CPU is melting.