sane service: support remote scanners

+20 -2
+19 -1
nixos/modules/services/hardware/sane.nix
··· 17 17 ''; 18 18 }; 19 19 20 + netConf = pkgs.writeTextFile { 21 + name = "net.conf"; 22 + destination = "/etc/sane.d/net.conf"; 23 + text = '' 24 + ${lib.optionalString config.services.saned.enable "localhost"} 25 + ${config.hardware.sane.netConf} 26 + ''; 27 + }; 28 + 20 29 env = { 21 30 SANE_CONFIG_DIR = config.hardware.sane.configDir; 22 31 LD_LIBRARY_PATH = [ "${saneConfig}/lib/sane" ]; 23 32 }; 24 33 25 - backends = [ pkg ] ++ optional config.services.saned.enable sanedConf ++ config.hardware.sane.extraBackends; 34 + backends = [ pkg netConf ] ++ optional config.services.saned.enable sanedConf ++ config.hardware.sane.extraBackends; 26 35 saneConfig = pkgs.mkSaneConfig { paths = backends; }; 27 36 28 37 enabled = config.hardware.sane.enable || config.services.saned.enable; ··· 70 79 type = types.string; 71 80 internal = true; 72 81 description = "The value of SANE_CONFIG_DIR."; 82 + }; 83 + 84 + hardware.sane.netConf = mkOption { 85 + type = types.lines; 86 + default = ""; 87 + example = "192.168.0.16"; 88 + description = '' 89 + Network hosts that should be probed for remote scanners. 90 + ''; 73 91 }; 74 92 75 93 services.saned.enable = mkOption {
+1 -1
pkgs/applications/graphics/sane/config.nix
··· 13 13 if [ -e "${path}/etc/sane.d" ]; then 14 14 find "${path}/etc/sane.d" -maxdepth 1 -not -type d | while read conf; do 15 15 name="$(basename $conf)" 16 - if [ "$name" = "dll.conf" ] || [ "$name" = "saned.conf" ]; then 16 + if [ "$name" = "dll.conf" ] || [ "$name" = "saned.conf" ] || [ "$name" = "net.conf" ]; then 17 17 cat "$conf" >> "$out/etc/sane.d/$name" 18 18 else 19 19 ln -s "$conf" "$out/etc/sane.d/$name"