sane service: support remote scanners
This commit is contained in:
parent
65f9341370
commit
382047a135
@ -17,12 +17,21 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
netConf = pkgs.writeTextFile {
|
||||||
|
name = "net.conf";
|
||||||
|
destination = "/etc/sane.d/net.conf";
|
||||||
|
text = ''
|
||||||
|
${lib.optionalString config.services.saned.enable "localhost"}
|
||||||
|
${config.hardware.sane.netConf}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
SANE_CONFIG_DIR = config.hardware.sane.configDir;
|
SANE_CONFIG_DIR = config.hardware.sane.configDir;
|
||||||
LD_LIBRARY_PATH = [ "${saneConfig}/lib/sane" ];
|
LD_LIBRARY_PATH = [ "${saneConfig}/lib/sane" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
backends = [ pkg ] ++ optional config.services.saned.enable sanedConf ++ config.hardware.sane.extraBackends;
|
backends = [ pkg netConf ] ++ optional config.services.saned.enable sanedConf ++ config.hardware.sane.extraBackends;
|
||||||
saneConfig = pkgs.mkSaneConfig { paths = backends; };
|
saneConfig = pkgs.mkSaneConfig { paths = backends; };
|
||||||
|
|
||||||
enabled = config.hardware.sane.enable || config.services.saned.enable;
|
enabled = config.hardware.sane.enable || config.services.saned.enable;
|
||||||
@ -72,6 +81,15 @@ in
|
|||||||
description = "The value of SANE_CONFIG_DIR.";
|
description = "The value of SANE_CONFIG_DIR.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hardware.sane.netConf = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
default = "";
|
||||||
|
example = "192.168.0.16";
|
||||||
|
description = ''
|
||||||
|
Network hosts that should be probed for remote scanners.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
services.saned.enable = mkOption {
|
services.saned.enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -13,7 +13,7 @@ let installSanePath = path: ''
|
|||||||
if [ -e "${path}/etc/sane.d" ]; then
|
if [ -e "${path}/etc/sane.d" ]; then
|
||||||
find "${path}/etc/sane.d" -maxdepth 1 -not -type d | while read conf; do
|
find "${path}/etc/sane.d" -maxdepth 1 -not -type d | while read conf; do
|
||||||
name="$(basename $conf)"
|
name="$(basename $conf)"
|
||||||
if [ "$name" = "dll.conf" ] || [ "$name" = "saned.conf" ]; then
|
if [ "$name" = "dll.conf" ] || [ "$name" = "saned.conf" ] || [ "$name" = "net.conf" ]; then
|
||||||
cat "$conf" >> "$out/etc/sane.d/$name"
|
cat "$conf" >> "$out/etc/sane.d/$name"
|
||||||
else
|
else
|
||||||
ln -s "$conf" "$out/etc/sane.d/$name"
|
ln -s "$conf" "$out/etc/sane.d/$name"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user