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
17
'';
18
18
};
19
19
20
20
+
netConf = pkgs.writeTextFile {
21
21
+
name = "net.conf";
22
22
+
destination = "/etc/sane.d/net.conf";
23
23
+
text = ''
24
24
+
${lib.optionalString config.services.saned.enable "localhost"}
25
25
+
${config.hardware.sane.netConf}
26
26
+
'';
27
27
+
};
28
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
25
-
backends = [ pkg ] ++ optional config.services.saned.enable sanedConf ++ config.hardware.sane.extraBackends;
34
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
82
+
};
83
83
+
84
84
+
hardware.sane.netConf = mkOption {
85
85
+
type = types.lines;
86
86
+
default = "";
87
87
+
example = "192.168.0.16";
88
88
+
description = ''
89
89
+
Network hosts that should be probed for remote scanners.
90
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
16
-
if [ "$name" = "dll.conf" ] || [ "$name" = "saned.conf" ]; then
16
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"