tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
sane service: support remote scanners
Nikolay Amiantov
9 years ago
382047a1
65f93413
+20
-2
2 changed files
expand all
collapse all
unified
split
nixos
modules
services
hardware
sane.nix
pkgs
applications
graphics
sane
config.nix
+19
-1
nixos/modules/services/hardware/sane.nix
···
17
'';
18
};
19
0
0
0
0
0
0
0
0
0
20
env = {
21
SANE_CONFIG_DIR = config.hardware.sane.configDir;
22
LD_LIBRARY_PATH = [ "${saneConfig}/lib/sane" ];
23
};
24
25
-
backends = [ pkg ] ++ optional config.services.saned.enable sanedConf ++ config.hardware.sane.extraBackends;
26
saneConfig = pkgs.mkSaneConfig { paths = backends; };
27
28
enabled = config.hardware.sane.enable || config.services.saned.enable;
···
70
type = types.string;
71
internal = true;
72
description = "The value of SANE_CONFIG_DIR.";
0
0
0
0
0
0
0
0
0
73
};
74
75
services.saned.enable = mkOption {
···
17
'';
18
};
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
+
29
env = {
30
SANE_CONFIG_DIR = config.hardware.sane.configDir;
31
LD_LIBRARY_PATH = [ "${saneConfig}/lib/sane" ];
32
};
33
34
+
backends = [ pkg netConf ] ++ optional config.services.saned.enable sanedConf ++ config.hardware.sane.extraBackends;
35
saneConfig = pkgs.mkSaneConfig { paths = backends; };
36
37
enabled = config.hardware.sane.enable || config.services.saned.enable;
···
79
type = types.string;
80
internal = true;
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
+
'';
91
};
92
93
services.saned.enable = mkOption {
+1
-1
pkgs/applications/graphics/sane/config.nix
···
13
if [ -e "${path}/etc/sane.d" ]; then
14
find "${path}/etc/sane.d" -maxdepth 1 -not -type d | while read conf; do
15
name="$(basename $conf)"
16
-
if [ "$name" = "dll.conf" ] || [ "$name" = "saned.conf" ]; then
17
cat "$conf" >> "$out/etc/sane.d/$name"
18
else
19
ln -s "$conf" "$out/etc/sane.d/$name"
···
13
if [ -e "${path}/etc/sane.d" ]; then
14
find "${path}/etc/sane.d" -maxdepth 1 -not -type d | while read conf; do
15
name="$(basename $conf)"
16
+
if [ "$name" = "dll.conf" ] || [ "$name" = "saned.conf" ] || [ "$name" = "net.conf" ]; then
17
cat "$conf" >> "$out/etc/sane.d/$name"
18
else
19
ln -s "$conf" "$out/etc/sane.d/$name"