Brother 2395dw printer driver setup?


#1

HI all-

I have a Brother HL-L2395DW printer, and I’m having some trouble figuring out how to get it working with CUPS under NixOS. I read the guide to printing on the wiki, but I am not sure which printer driver to use. I tried setting services.printing.drivers to a list containing pkgs.hll2390dw-cups (following this). I also tried pkgs.brlaser as mentioned in the wiki page, but in both cases nixos-rebuild tells me “attribute missing”.

So, (1) can someone advise me on the right driver to use? and (2) how should I be invoking the driver packages that come with NixOS?

Thanks!

roni


#2

Try out:

services.printing = {
  enable = true;
  drivers = [ pkgs.brlaser pkgs.hll2390dw-cups ];
};

#3

Thank you!

This seems to have worked. I didn’t have the brother packages in scope when I first tried but after properly upgrading to 18.09 (I know, I’m behind a few months :-P) it looks like I’m able to print!

roni


#4

So as I mentioned, printing works now, but my printer seems to add too much head space–that is, the bottom of the page gets cut off, and the top of the page shows too much empty space.

Any idea what is causing that? If it’s a known problem, can you suggest how to put in a fix the “NixOS way”?

Thanks!

roni


#5

I’ve had this same problem, too, but now would be a good time to fix it.
Might as well help others as I figure it out myself!

Looking at a StackOverflow post on CUPS margins, it seems like default margins can be set imperatively via the lpoptions command.

More specifically, the following should set the margins, replacing N with values in units of points, with 72 points to an inch:

lpoptions -p PRINTER_NAME \
  -o page-bottom=N \
  -o page-left=N   \
  -o page-right=N  \
  -o page-top=N

Running the above command should update printing config files located either at /etc/cups/lpoptions or ~/.cups/lpoptions.

I’d run the above command (you can press tab to fill the printer name), and take a look at the config file it generates (checking both locations mentioned above).
I’d then put the contents of said configuration file in my NixOS config, using home manager [1].

I’m not able to test the above right now but I plan on doing so later this week.

Best of luck, and report back whether it works and/or if you have more questions

[1] If you don’t use home manager already, I recommend giving it a try; it allows you to use your nixos config to specify the contents of files throughout your system, making it super helpful for configuring things not (yet) implemented as one of NixOS’ options.


#6

Thank you for informing me about lpoptions and how it works (and also the note about home-manager, which I have heard about but have not tried yet).

I am not sure what values to use for the margins: when I set page-top to 72, I don’t get any change in the printing. Furthermore, I’m not sure why I should be setting margins at all. Doesn’t the file to be printed already know what its margins are?

A further quirk: I tried to roughly measure the top and left side “extra margin” on my print jobs, and I’ve discovered something interesting. The top margin is about 3/4 in too large, while the left side edge is off by about 1/8 in. These values seem to correspond to the size difference between US Letter and A4…

The CUPS default setting for my printer is Letter paper; however, it shows up as media=na_letter_8.5x11in when CUPS shows me the default options for the printer. That looks weird; shouldn’t it just say Letter? Could this somehow be causing the problem? Is my printer trying to print A4 pages onto my Letter paper?

Thanks again for your help!!

roni


#7

The top margin is about 3/4 in too large, while the left side edge is off by about 1/8 in. These values seem to correspond to the size difference between US Letter and A4…

Nice investigative work!

Try going to http://localhost:631/printers, clicking on your printer, then going to Administration > Set Default Options.

If I am correct, changing these options (which include paper size), should modify /etc/cups/ppd/PRINTER_NAME.ppd.

Try taking a look at, and possibly changing, those values. If it fixes the problem, you could put the ppd file in your NixOS config.

Cheers, and I love helping, no problem!


#8

Finally got a chance to try this–indeed, changing, e.g., the default paper size via Administration > Set Default Options does change “Letter” to “A4” in /etc/cups/ppd/home-office.ppd, but the trouble is that even when it’s set properly to “Letter”, I still get that annoying extra headspace on the test print!

I thought I might try using an external PPD file from the manufacturer to see if that works. The problem is, the PPD file references a cupsfilter program that is not present in the nix store (specifically, CUPS looks for a filter specific to the model name within the cups-progs package). I have the filter program (it is part of the rpm bundle that the PPD came in), but I need a way to get it into cups-progs.

How can I modify the cups-progs package to include this filter program?

Thanks for your help so far!

roni


#9

You might want to check out https://github.com/NixOS/nixpkgs/issues/53027, since it looks like that’s what you’re looking for.


#10

Amazing, thank you, will give this a whirl.

roni