8 cfg = config.hardware.sane.brscan5;
10 netDeviceList = lib.attrValues cfg.netDevices;
12 etcFiles = pkgs.callPackage ./brscan5_etc_files.nix { netDevices = netDeviceList; };
23 The friendly name you give to the network device. If undefined,
24 the name of attribute will be used.
30 model = lib.mkOption {
33 The model of the network device.
40 type = with lib.types; nullOr str;
43 The ip address of the device. If undefined, you will have to
47 example = "192.168.1.2";
50 nodename = lib.mkOption {
51 type = with lib.types; nullOr str;
54 The node name of the device. If undefined, you will have to
58 example = "BRW0080927AFBCE";
64 name = lib.mkDefault name;
73 hardware.sane.brscan5.enable = lib.mkEnableOption "the Brother brscan5 sane backend";
75 hardware.sane.brscan5.netDevices = lib.mkOption {
84 nodename = "BRW0080927AFBCE";
87 type = with lib.types; attrsOf (submodule netDeviceOpts);
89 The list of network devices that will be registered against the brscan5
95 config = lib.mkIf (config.hardware.sane.enable && cfg.enable) {
97 hardware.sane.extraBackends = [
101 environment.etc."opt/brother/scanner/brscan5" = {
102 source = "${etcFiles}/etc/opt/brother/scanner/brscan5";
104 environment.etc."opt/brother/scanner/models" = {
105 source = "${etcFiles}/etc/opt/brother/scanner/brscan5/models";
107 environment.etc."sane.d/dll.d/brother5.conf".source =
108 "${pkgs.brscan5}/etc/sane.d/dll.d/brother5.conf";
112 assertion = lib.all (x: !(null != x.ip && null != x.nodename)) netDeviceList;
114 When describing a network device as part of the attribute list
115 `hardware.sane.brscan5.netDevices`, only one of its `ip` or `nodename`
116 attribute should be specified, not both!