mirror of
https://codeberg.org/privacy1st/nix-git
synced 2024-11-23 22:19:33 +01:00
68 lines
2.2 KiB
Nix
68 lines
2.2 KiB
Nix
{ config, pkgs, ... }:
|
|
{
|
|
# Printing with IPP everywhere capable printers
|
|
# https://nixos.wiki/wiki/Printing
|
|
# Share printer via AirPrint
|
|
# https://project-insanity.org/2021/10/12/share-printer-via-airprint-with-nixos/
|
|
# After following these steps, my manually added Lexmark E460dn was instantly found on an Apple iPad and with Windows 10.
|
|
|
|
# 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.
|
|
nssmdns4 = true;
|
|
nssmdns6 = true;
|
|
# Network printers
|
|
openFirewall = true;
|
|
publish = {
|
|
enable = true;
|
|
userServices = true;
|
|
};
|
|
};
|
|
|
|
# Scanning
|
|
# 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
|
|
hardware.sane = {
|
|
enable = true;
|
|
# Optionally, add pkgs.sane-airscan for AirScan.
|
|
extraBackends = [ pkgs.hplip ];
|
|
};
|
|
|
|
users.users.yoda = {
|
|
extraGroups = [ "scanner" "lp" ];
|
|
packages = with pkgs; [
|
|
gnome.simple-scan
|
|
];
|
|
};
|
|
}
|