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:
First, disable CUPS in your configuration by setting
services.printing.enable = false;
in your configuration.nix.Then, add the LPRng package to your system packages:
environment.systemPackages = with pkgs; [ lprng # other packages... ];
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"; }; };
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 -" ];
After adding these configurations, rebuild your NixOS system:
sudo nixos-rebuild switch
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.