2023-08-31 12:59:49 +02:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
{
|
|
|
|
# Printing with IPP everywhere capable printers
|
2023-10-12 17:57:08 +02:00
|
|
|
# https://nixos.wiki/wiki/Printing
|
|
|
|
# Share printer via AirPrint
|
|
|
|
# https://project-insanity.org/2021/10/12/share-printer-via-airprint-with-nixos/
|
2023-11-29 17:35:06 +01:00
|
|
|
# After following these steps, my manually added Lexmark E460dn was instantly found on an Apple iPad and with Windows 10.
|
2023-08-31 12:59:49 +02:00
|
|
|
|
2023-10-12 17:57:08 +02:00
|
|
|
# When adding the Lexmark E460dn printer (via GNOME settings or directly on the CUPS web interface),
|
|
|
|
# it is not found lateron. Discovery through the detected URL does not work.
|
|
|
|
# Instead, I added it manually.
|
|
|
|
# - When adding a printer, select `AppSocket/HP JetDirect` as type.
|
|
|
|
# - Then fill in the IP of the printer, e.g. `socket://192.168.178.107:9100`
|
|
|
|
# Reference: https://infoserve.lexmark.com/ids/ifc/ids_topic.aspx?root=kb20220119195146366&gid=v54804876&id=v54804875&topic=HO2475&productCode=Lexmark_T642&loc=en_CA
|
|
|
|
|
|
|
|
networking.firewall = {
|
|
|
|
allowedTCPPorts = [ 631 ];
|
|
|
|
allowedUDPPorts = [ 631 ];
|
|
|
|
};
|
|
|
|
|
|
|
|
services.printing = {
|
|
|
|
# Enable CUPS to print documents.
|
|
|
|
enable = true;
|
|
|
|
# HP and Lexmark drivers
|
|
|
|
drivers = [ pkgs.hplip pkgs.postscript-lexmark ];
|
|
|
|
# Specifies whether shared printers are advertised.
|
|
|
|
browsing = true;
|
|
|
|
defaultShared = true;
|
|
|
|
listenAddresses = [ "*:631" ];
|
|
|
|
allowFrom = [ "all" ];
|
|
|
|
extraConf = ''
|
|
|
|
DefaultPaperSize A4
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
services.avahi = {
|
|
|
|
enable = true;
|
|
|
|
# Whether to enable the mDNS NSS (Name Service Switch) plug-in.
|
|
|
|
# Enabling it allows applications to resolve names in the .local domain by transparently querying the Avahi daemon.
|
|
|
|
# -> Discover network printers.
|
2024-07-12 23:08:13 +02:00
|
|
|
nssmdns4 = true;
|
|
|
|
nssmdns6 = true;
|
2023-10-12 17:57:08 +02:00
|
|
|
# Network printers
|
|
|
|
openFirewall = true;
|
|
|
|
publish = {
|
|
|
|
enable = true;
|
|
|
|
userServices = true;
|
|
|
|
};
|
|
|
|
};
|
2023-08-31 12:59:49 +02:00
|
|
|
|
|
|
|
# Scanning
|
2023-10-12 17:57:08 +02:00
|
|
|
# https://nixos.wiki/wiki/Scanners
|
|
|
|
# HP OfficeJet scanning
|
|
|
|
# https://unix.stackexchange.com/questions/518687/how-do-i-set-up-scanning-from-an-hp-officejet-pro-on-nixos/518688
|
2023-08-31 12:59:49 +02:00
|
|
|
hardware.sane = {
|
|
|
|
enable = true;
|
|
|
|
# Optionally, add pkgs.sane-airscan for AirScan.
|
|
|
|
extraBackends = [ pkgs.hplip ];
|
|
|
|
};
|
|
|
|
|
|
|
|
users.users.yoda = {
|
|
|
|
extraGroups = [ "scanner" "lp" ];
|
|
|
|
packages = with pkgs; [
|
2024-12-03 22:16:26 +01:00
|
|
|
simple-scan
|
2023-08-31 12:59:49 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|