this are my settings as a module, works w/o any flaws, @peterhoeg is a mf’ing genius who’s all over the nix repos, so you betch it works
{ config, lib, pkgs, ... }:
# https://nixos.wiki/wiki/Printing
# https://developers.hp.com/hp-linux-imaging-and-printing
#
# Most modern printers are capable of the IPP everywhere protocol, ie printing without installing drivers.
# This is notably the case of all WiFi printers marketed as Apple-compatible
# see https://support.apple.com/en-ca/HT201311
#
# Check existing printers with lpstat -s and remove printers with lpadmin -x <printer-name>
# lpoptions [-p printername] -l shows supported PPD options for the given printer.
#
# HP Color LaserJet Pro M454dw
#
# CUPS:
# http://localhost:631/
{
services.printing.drivers = with pkgs; [ hplip ];
hardware =
let
printer = "HP_Color_LaserJet_Pro_M454dw";
hostName = "192.168.1.25";
in
{
printers = {
ensureDefaultPrinter = printer;
ensurePrinters = [
{
name = printer;
deviceUri = "ipp://${hostName}";
model = "HP/hp-color_laserjet_pro_m453-4-ps.ppd.gz"; # Location of the ppd driver file for the printer. lpinfo -m shows a list of supported models.
description = lib.replaceStrings [ "_" ] [ " " ] printer;
location = "Home";
ppdOptions = { # lpoptions [-p printername] -l shows supported PPD options for the given printer.
PageSize = "A4";
};
}
];
};
};
}
hope this helps …