Printer Issue | Broken Package

I was trying to set up my HP LaserJet 1020, so I enabled printing and used the foo2zjs driver package, but it didn’t work. So, I started investigating and saw that the firmware was missing. This is due to the nix package not being able to download it because it is using the original version, which the URL doesn’t work anymore (the site is down). This version patches the links and I could get the firmware just fine, compiled the arm2hpdl and used it to create the .dl file. But, I don’t know what to do now. If anyone can help me figuring out if I just need to place in the share/foo2zjs/firmware folder, or need to fix the nix package (I don’t see even it trying to use the so I assume it’s not handling firmware)…

I also tried hplipWithPlugin, the problem with it is that when I restart my computer the printer stops working…

Edit: I was looking and I think the package just need to change the URL and add “getweb all” to the preInstall. The “make install” will call install-extra, which will properly configure the firmwares.

Edit2: wget also need to be added as a dependency.

  1. can you send part of your configuration which is for printer ?
  2. also give this a try and check if it’s working after restart or not
  services.printing.enable = true;
  services.printing.drivers = [ pkgs.hplip ];
  1. what’s the output of these two command (privacy is important so modify the output before sending)
lpstat -v -p
lpinfo -v
  1. describe which package should be fixed and give the new link or any other fix that you guess should be applied (if you already know how to use overrideAttrs you can probably fix this by yourself but if you don’t, there is no problem i will try to help you about it)
  1. and 2.
  # Enable CUPS to print documents.
  services.printing = {
    enable = true;
    # drivers = [ pkgs.hplipWithPlugin ];
    drivers = [ pkgs.hplip ];
    # drivers = [ pkgs.foo2zjs ];
dispositivo de HP-LaserJet-1020: hp:/usb/HP_LaserJet_1020?serial=FZ04WTF
impressora HP-LaserJet-1020 está inativa; habilitada desde seg 20 nov 2023 15:04:38
	ready to print
network beh
network https
network ipp
network lpd
network ipps
network socket
network http
direct usb://HP/LaserJet%201020?serial=FZ04WTF
direct hp:/usb/HP_LaserJet_1020?serial=FZ04WTF
network smb

These are the results with your configuration, the KDE printing page shows ‘Filter Failed’ when I try to print something.

Note: I did some research and it seems that this ‘Filter Failed’ is often related to out-of-date packages like ghostscript or hplip. I saw that NixOS is using hplip version 3.23.3, and Arch is using version 3.23.8, and NixOS is using ghostscript 10.02.0, while Arch is using 10.02.1.

before continuing i should tell you something
it’s not a long time since i joined nix and i found nix community helpful and friendly
i started answering to you without much knowledge (at least i should have mentioned about my lack of knowledge) and probably wasted your time
so i apologize and tell i’m bad but nix community is great

try this which will use the latest hplip

  services.printing = {
    enable = true;
    drivers = with pkgs; [
      (hplip.overridePythonAttrs (old:
          pname = "hplip";
          version = "3.23.8";
          src = fetchurl {
            url = "mirror://sourceforge/hplip/${pname}-${version}.tar.gz";
            sha256 = "sha256-98wF9ijAz9dQ5UrkFDHB390p6XaC8YtcW6XLLFtLG0Y=";

after that try this and check if it triggers your printer and what’s the output of command

(echo "Hello world" > p.txt) && lp -d HP-LaserJet-1020 p.txt
1 Like

Hey man, don’t apologize. We’re all here to learn and help each other! I actually installed NixOS 3 days ago and already made a package that was merged! This is the great thing about this community, it is not only inclusive, but very participative! So keep it up and try help the way you can, we’re all grateful!


So, it worked the same way as before. I modified your code a little bit to include the plugin. When I install for the first time the hplipWithPlugin and run the command on the wiki, it works. But, as soon as I disconnect the cable/turn off the printer/turn off the computer it just stops working. I’m starting to suspect that this is due to the fixes and patches on the package itself. I reached that conclusion because when I install the drivers my printer “reloads” (making some noise). Every time I plug it again it also makes the noise, but it doesn’t seem to be working… I made a PR to update to the latest version but this won’t solve my issue. Thanks anyways and I hope I can make it work someday!

1 Like

sounds Frustrating…thanks for the PR. Printers are the bane of my life…

A little bit of history, closed printers is why the whole GNU tool set exists… Stallman was having these sorts of problems back in the 70’s, so he want to be able to modify the software/firmware of the printer, but could not…hence FOSS was born!!

This might make you feel better.

Oh, really cool funfact! Also, this made me feel better lol.