8 cfg = config.hardware.sane.brscan4;
10 netDeviceList = lib.attrValues cfg.netDevices;
12 etcFiles = pkgs.callPackage ./brscan4_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.
36 example = "MFC-7860DW";
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.brscan4.enable = lib.mkEnableOption "Brother's brscan4 scan backend" // {
75 When enabled, will automatically register the "brscan4" sane
76 backend and bring configuration files to their expected location.
80 hardware.sane.brscan4.netDevices = lib.mkOption {
89 nodename = "BRW0080927AFBCE";
92 type = with lib.types; attrsOf (submodule netDeviceOpts);
94 The list of network devices that will be registered against the brscan4
100 config = lib.mkIf (config.hardware.sane.enable && cfg.enable) {
102 hardware.sane.extraBackends = [
106 environment.etc."opt/brother/scanner/brscan4" = {
107 source = "${etcFiles}/etc/opt/brother/scanner/brscan4";
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.brscan4.netDevices`, only one of its `ip` or `nodename`
116 attribute should be specified, not both!