{ lib, pkgs, ... }:
{

  # airprint
  # https://wiki.nixos.org/wiki/Printing#Printer_sharing

  services.avahi = {
    enable = lib.mkDefault true;
    nssmdns = true;
    openFirewall = true; # opens port 5353
    publish.enable = true;
    publish.userServices = true;
  };
  services.printing = {
    defaultShared = true;
    browsing = true;
    # allows anonymous access to printer
    listenAddresses = [ "*:631" ];
    allowFrom = [ "all" ];
    openFirewall = true;
  };


  # samba
  # https://wiki.nixos.org/wiki/Samba#Printer_sharing

  /** /
  services.samba = {
    enable = lib.mkDefault true;
    package = pkgs.sambaFull; # compiled with CUPS

    openFirewall = true;
    settings = {
      "global" = {
        "load printers" = "yes";
        "printing" = "cups";
        "printcap name" = "cups";
      };
      "printers" = {
        "comment" = "All Printers";
        "path" = "/var/spool/samba";
        "public" = "yes";
        "browseable" = "yes";
        # allow user 'guest account' to print.
        "guest ok" = "yes";
        "writable" = "no";
        "printable" = "yes";
        "create mode" = 0700;
    };
  };
  systemd.tmpfiles.rules = [
    "d /var/spool/samba 1777 root root -"
  ];
  /**/

}
