{ config, pkgs, ... }:

{
  # Printing with IPP everywhere capable printers
  # https://nixos.wiki/wiki/Printing

  # Enable CUPS to print documents.
  services.printing.enable = true;
  # HP and Lexmark drivers
  services.printing.drivers = [ pkgs.hplip pkgs.postscript-lexmark ];
  services.avahi.enable = true;
  services.avahi.nssmdns = true;
  # WiFi printers
  services.avahi.openFirewall = true;

  # Scanning
  # https://nixos.wiki/wiki/Scanners
  # 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
    ];
  };
}
