diff --git a/configuration/devices/headless/raspberry-pi-4/ulquiorra/print-server.nix b/configuration/devices/headless/raspberry-pi-4/ulquiorra/print-server.nix index 2579da0b..a5e7c699 100644 --- a/configuration/devices/headless/raspberry-pi-4/ulquiorra/print-server.nix +++ b/configuration/devices/headless/raspberry-pi-4/ulquiorra/print-server.nix @@ -1,24 +1,35 @@ -{ pkgs, ... }: { - hardware.printers.ensurePrinters = [{ - name = "Default"; - - # lpinfo -v - deviceUri = "hp:/usb/ENVY_4500_series?serial=CN4CS2325205X4"; - - # lpinfo -m - model = "HP/hp-envy_4500_series.ppd.gz"; - - # lpoptions -p Default -l - ppdOptions = { - ColorModel = "KGray"; - Duplex = "None"; - InputSlot = "Auto"; - MediaType = "Plain"; - OptionDuplex = "False"; - OutputMode = "Normal"; - PageSize = "A4"; +{ pkgs, config, ... }: { + # Required for sane + boot.kernelModules = [ "sg" "usblp" ]; + + hardware = { + printers.ensurePrinters = [{ + name = "Default"; + + # lpinfo -v + deviceUri = "hp:/usb/ENVY_4500_series?serial=CN4CS2325205X4"; + + # lpinfo -m + model = "HP/hp-envy_4500_series.ppd.gz"; + + # lpoptions -p Default -l + ppdOptions = { + ColorModel = "KGray"; + Duplex = "None"; + InputSlot = "Auto"; + MediaType = "Plain"; + OptionDuplex = "False"; + OutputMode = "Normal"; + PageSize = "A4"; + }; + }]; + + sane = { + enable = true; + + extraBackends = [ pkgs.hplipWithPlugin ]; }; - }]; + }; services = { # lsusb @@ -48,6 +59,15 @@ ''; }; + saned.enable = true; + + scanservjs = { + enable = true; + + # TODO remove + settings.host = "0.0.0.0"; + }; + avahi = { enable = true; @@ -62,4 +82,7 @@ }; }; }; + + # TODO remove use nginx + networking.firewall.allowedTCPPorts = [ config.services.scanservjs.settings.port ]; } diff --git a/modules/default/scanservjs.nix b/modules/default/scanservjs.nix new file mode 100644 index 00000000..7a41fbd6 --- /dev/null +++ b/modules/default/scanservjs.nix @@ -0,0 +1,18 @@ +# TODO remove when merged https://nixpk.gs/pr-tracker.html?pr=249806 + +let + src = let + owner = "NixOS"; + repo = "nixpkgs"; + rev = "c861052eab51de685f2286ce75d6e67395f6eae5"; + sha256 = "sha256:1j3drcp4mizf90dcpvnfajx1b49m8ijfq7w6a53kyfgx22r1x51i"; + in builtins.fetchTarball { + name = "nixpkgs"; + url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; + inherit sha256; + }; +in { + imports = [ "${src}/nixos/modules/services/hardware/scanservjs.nix" ]; + + nixpkgs.overlays = [ (_: super: { scanservjs = super.callPackage "${src}/pkgs/applications/graphics/scanservjs/default.nix" { }; }) ]; +} diff --git a/modules/profiles/printing.nix b/modules/profiles/printing.nix index 0cbb4d20..7a788b99 100644 --- a/modules/profiles/printing.nix +++ b/modules/profiles/printing.nix @@ -26,6 +26,4 @@ nssmdns6 = true; }; }; - - environment.systemPackages = [ pkgs.simple-scan ]; }