Hi,
I’m having a weirdly frustrating situation with my printer (surprise surprise…) where the printer itself, declaratively configured like this:
{ pkgs, ... }:
{
services.printing.enable = true;
services.printing.drivers = [ pkgs.brlaser ];
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
hardware.printers = {
ensurePrinters = [
{
name = "Drucker";
location = "Home";
description = "Brother HL-L2375DW";
deviceUri = "ipp://192.168.50.101";
model = "drv:///brlaser.drv/brl2375w.ppd";
ppdOptions = {
PageSize = "A5"; # just for testing
Duplex = "DuplexNoTumble";
};
}
];
ensureDefaultPrinter = "Drucker";
};
}
works perfectly, except for the ppdOptions
, which seemingly get discarded / ignored.
The following is the output of lpoptions -l -p Drucker
:
PageSize/Media Size: *A4 A5 A6 B5 B6 EnvC5 EnvMonarch EnvDL Executive Legal Letter
Resolution/Resolution: *600dpi 1200dpi
InputSlot/Media Source: *Auto Tray1 Tray2 Tray3 MPTray Manual
MediaType/Media Type: *PLAIN THIN THICK THICKER BOND TRANS ENV ENV-THICK ENV-THIN
brlaserEconomode/Toner save mode: *False True
Duplex/2-Sided Printing: *None DuplexNoTumble DuplexTumble
I have tried using "Duplex/2-Sided Printing"
or just "2-Sided Printing"
as a key as well, no luck. Just to reiterate, the printer itself works perfectly fine, and if I use the system dialog to print and change the duplex option there, the printer will indeed print 2-sided.
I feel like I’m missing something obvious here, can someone help me out?
sleepy
April 11, 2024, 2:20pm
2
Interesting, I have the reverse problem, so to speak (but using a Brother HL-2270DW): no matter what I change in my config or manually set in print dialogs (global GNOME settings or application specific settings), the printer always prints duplex.
$ lpoptions -l
PageSize/Media Size: *A4 A5 A6 B5 B6 EnvC5 EnvMonarch EnvDL Executive Legal Letter
Resolution/Resolution: *600dpi 1200dpi 300dpi
InputSlot/Media Source: *Auto Tray1 Tray2 Tray3 MPTray Manual
MediaType/Media Type: *PLAIN THIN THICK THICKER BOND TRANS ENV ENV-THICK ENV-THIN
brlaserEconomode/Toner save mode: False *True
Duplex/2-Sided Printing: *None DuplexNoTumble DuplexTumble
The only workaround for the moment is to create a print job for each page separately, which is very tedious.
Huh, interesting! I just tried (because I realized I had not actually tried printing non-duplex yet), but in my case two separate sheets come out of the printer, and the print dialog options do work.
This has to be connected somehow though
I’m having the exact same issue.
I have the following config:
hardware.printers = {
ensurePrinters = [
{
name = "...";
location = "...";
deviceUri = "dnssd://Lexmark%20MS510dn%20(3)._ipp._tcp.local/?uuid=bb9f86e6-3117-4c3c-9297-a5923efbc4e1";
model = "drv:///sample.drv/generic.ppd";
ppdOptions = {
PageSize = "A4";
Duplex = "DuplexNoTumble";
Duplexer = "True";
};
}
];
};
And I’m able to edit the settings trough CUPS, but when I rebuild my NixOS config, it fallback to the default value:
PageSize/Media Size: *Letter Legal Executive Tabloid A3 A4 A5 B5 EnvISOB5 Env10 EnvC5 EnvDL EnvMonarch
InputSlot/Media Source: *Default Upper Manual
Duplex/2-Sided Printing: *None DuplexNoTumble DuplexTumble
Option1/Duplexer: *False True
Which is very annoying for printing.
I think I know what’s going wrong. The script generated by nixos/modules/hardware/printers.nix
looks like this:
#!/nix/store/h3bhzvz9ipglcybbcvkxvm4vg9lwvqg4-bash-5.2p26/bin/bash
set -e
/nix/store/hpjirfjbrqqmjy5c66dvwb1gw9gqbsib-cups-2.4.7/bin/lpadmin '-D' 'Brother HL-L2375DW' '-L' 'Home' '-m' 'drv:///brlaser.drv/brl2375w.ppd' '-o' ''\''Duplex'\''='\''DuplexNoTumble'\''' '-o' ''\''PageSize'\''='\''A4'\''' '-p' 'Drucker' '-v' 'ipp://192.168.50.100' -E
/nix/store/hpjirfjbrqqmjy5c66dvwb1gw9gqbsib-cups-2.4.7/bin/lpadmin -d 'Drucker'
… that’s just too many escapedd quotes! Indeed, removing the unnecessary quotes from the important line from that script works.
LMAO, this was fixed literally yesterday : https://github.com/NixOS/nixpkgs/pull/316696/
Good news for us, I guess