Printing without Cups. Where is lprng service?

I’m trying to setup my system in a way that I can print without Cups. Ideally also without IPP-USB, which is the next best choice. But I’m stuck at not being able to restart lpr or lprng as a service. I do have the lpr command available. I can’t find any of it in the repo on the website and “lprng” does not install.

This is what I want to do - The output is from my discussion with Claude AI:

Thanks for providing that information. It looks like your NixOS system has the CUPS printing system configured, but not LPRng specifically. This explains why you don’t see an LPR service.

Since you want to set up an LPR-based printing solution without CUPS, here’s what you can do on NixOS:

  1. First, disable CUPS in your configuration by setting services.printing.enable = false; in your configuration.nix.

  2. Then, add the LPRng package to your system packages:

    environment.systemPackages = with pkgs; [
      lprng
      # other packages...
    ];
    
  3. You’ll need to create a custom service for LPRng. Add something like this to your configuration.nix:

    systemd.services.lprng = {
      description = "LPRng Printing Service";
      wantedBy = [ "multi-user.target" ];
      serviceConfig = {
        ExecStart = "${pkgs.lprng}/sbin/lpd -F";
        Type = "forking";
      };
    };
    
  4. Create the printcap file and spool directories:

    environment.etc."printcap".text = ''
      samsung_m2022:\
        :sd=/var/spool/lpd/samsung_m2022:\
        :mx#0:\
        :sh:\
        :lp=/dev/usb/lp0:
    '';
    
    systemd.tmpfiles.rules = [
      "d /var/spool/lpd/samsung_m2022 0770 lp lp -"
    ];
    
  5. After adding these configurations, rebuild your NixOS system:

    sudo nixos-rebuild switch
    
  6. Then you should be able to start the LPRng service:

    sudo systemctl start lprng
    

If you encounter any issues with this setup, please let me know, and I can help troubleshoot. NixOS’s declarative approach makes it different from traditional Linux distributions when it comes to service configuration.

Before I tried to change the printcap file manually, and use this, but it didn’t work. lsusb detects my printer, “lpstat -v” gives me “lpstat: Scheduler is not running.” and lpinfo -v returns “lpinfo: Bad file descriptor”.

I’m running the current NixOS version on some old Intel laptop.

Update: I realized that lprng might not have a service and maybe don’t need it. AI is good for helping, but it sometimes makes stuff up unintentionally. I changed the printrun file manually but need to add this to the config later, I already got help with that.

So, I’m still on it. Making this here work is the goal:
foomatic-rip -P ~/Downloads/Samsung_M2022/Samsung-M2020-Series.ppd -p '/home/.../temp.ps' | sudo ~/.../Samsung_M2022/rastertosamsungspl > /dev/usb/lp0

In my case the problem is, that my printer only supports SPL, some proprietary Samsung printer language. It does not accept postscript files. I also don’t want to use a Windows driver or any other way that honors the page counter chip of the printer, since I have refilled toner cartridges.

Then I had to work around the problem that rastertosamsungspl, which I got from some driver package), requires

ldd ~/.../rastertosamsungspl
        linux-vdso.so.1 (0x00007ffde19e3000)
        libcups.so.2 => not found
        libcupsimage.so.2 => not found

I got these files from the cups package on NixOS, but these are 32bit and now it wants 64bit. So I thought I had to change one or the other. It’s a can of worms. :weary: But somehow using Nix-ld and fixing some other error seems to help. Strace still shows errors like: … -1 ENOENT (No such file or directory).

But it seems primarily I have to find out how to use rastertosamsungspl: Usage: rastertosamsungspl job-id user title copies options [ file] Hopefully, then it will work.