1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ config, pkgs, unfreeAndNonDistributablePkgs, lib, ... }:

with lib;
let
  cfg = config.profpatsch.user.profpatsch.programs.scanning;

in {
  options.profpatsch.user.profpatsch.programs.scanning = {
    enable = mkEnableOption "scanning & simple-scan & ScanSnap drivers";

    remoteScanners = mkOption {
      type = lib.types.lines;
      default = "";
      description = ''
        See {option}`hardware.sane.extraBackends`.
        Proxy, because I may want to change this option.
      '';
    };
  };

  config = mkIf cfg.enable {
    environment.systemPackages = [ pkgs.simple-scan ];
    hardware.sane = {
      enable = true;
      netConf = cfg.remoteScanners;
      # extraBackends = [ unfreeAndNonDistributablePkgs.hplipWithPlugin ];

      drivers.scanSnap = {
        enable = true;
        package = unfreeAndNonDistributablePkgs.sane-drivers.epjitsu;
      };
    };
  };
}