From fad69be93683f16212be28ef381316bde35e7453 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 24 Jan 2025 13:50:26 +0000 Subject: [PATCH] setup remote scanning --- hosts/common/optional/print-server.nix | 45 +++++++++++++++++--------- hosts/common/optional/printing.nix | 1 + 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/hosts/common/optional/print-server.nix b/hosts/common/optional/print-server.nix index 0467140..beb4c64 100644 --- a/hosts/common/optional/print-server.nix +++ b/hosts/common/optional/print-server.nix @@ -1,10 +1,18 @@ -{pkgs, ...}: { +{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]; @@ -28,19 +36,26 @@ }; }; - hardware.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"; + 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"; + }; }; } diff --git a/hosts/common/optional/printing.nix b/hosts/common/optional/printing.nix index 178c5ce..66d731a 100644 --- a/hosts/common/optional/printing.nix +++ b/hosts/common/optional/printing.nix @@ -7,6 +7,7 @@ in { services = { udev.packages = [pkgs.sane-airscan]; + hardware.sane.netConf = serverIp; printing = { enable = true; drivers = [pkgs.gutenprint pkgs.hplip];