{pkgs, configVars, ...}: let gatewayIp = configVars.networking.addresses.gateway.ip; in { networking.firewall = { allowedTCPPorts = [631]; allowedUDPPorts = [631]; }; services = { udev.packages = [pkgs.sane-airscan]; ipp-usb.enable = true; saned = { enable = true; extraConfig = "${gatewayIp}/24"; }; printing = { enable = true; drivers = [pkgs.hplip]; browsing = true; defaultShared = true; listenAddresses = ["*:631"]; allowFrom = ["all"]; extraConf = '' DefaultPaperSize A4 ''; }; avahi = { enable = true; nssmdns = true; openFirewall = true; publish = { enable = true; userServices = true; }; }; }; hardware = { sane = { enable = true; extraBackends = [pkgs.sane-airscan pkgs.hplipWithPlugin]; openFirewall = true; }; printers = { ensurePrinters = [ { name = "HP_Envy_6000"; location = "Home"; deviceUri = "usb://HP/ENVY%206000%20series?serial=TH0B93F08W&interface=1"; # deviceUri = "usb://Dell/1250c%20Color%20Printer?serial=YNP023240"; model = "HP/hp-deskjet_plus_6000_series.ppd.gz"; ppdOptions = { PageSize = "A4"; }; } ]; ensureDefaultPrinter = "HP_Envy_6000"; }; }; }