In /etc/nixos/configuration.nix:
services.printing.enable = true;
services.printing.drivers = [ pkgs.hplip ];
services.printing.startWhenNeeded = true; # optional
users.users.<someone>.extraGroups = [ ... "lp" ... ];
Run nix run nixos.hplip -c hp-makeuri <ip address or name of the printer>:
...
CUPS URI: hp:/net/Officejet_Pro_8600?ip=<ip address or name of the printer>
...
Open browser at http://localhost:631/admin,
Then Add printer,
Choose local printers : [x] HP Printer (HPLIP),
Next,
Fill Connection field with previously generated URI: hp:/net/Officejet_Pro_8600?ip=<ip address or name of the printer>,
Next,
Fill in name / desc / etc... fields