summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2016-11-11 04:12:04 +0300
committerNikolay Amiantov <ab@fmap.me>2016-11-20 19:09:03 +0300
commit382047a135811f4e12fdeb11efd39b504b750a1c (patch)
tree5f409ddfc5673d4bdd367e246c8378a297a10eda /nixos
parent65f93413708a1aa6b43b573f5d8bebe50fc0f58c (diff)
downloadnixlib-382047a135811f4e12fdeb11efd39b504b750a1c.tar
nixlib-382047a135811f4e12fdeb11efd39b504b750a1c.tar.gz
nixlib-382047a135811f4e12fdeb11efd39b504b750a1c.tar.bz2
nixlib-382047a135811f4e12fdeb11efd39b504b750a1c.tar.lz
nixlib-382047a135811f4e12fdeb11efd39b504b750a1c.tar.xz
nixlib-382047a135811f4e12fdeb11efd39b504b750a1c.tar.zst
nixlib-382047a135811f4e12fdeb11efd39b504b750a1c.zip
sane service: support remote scanners
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/hardware/sane.nix20
1 files changed, 19 insertions, 1 deletions
diff --git a/nixos/modules/services/hardware/sane.nix b/nixos/modules/services/hardware/sane.nix
index e69209c560b5..8ddb9ef9c53b 100644
--- a/nixos/modules/services/hardware/sane.nix
+++ b/nixos/modules/services/hardware/sane.nix
@@ -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 = {
     SANE_CONFIG_DIR = config.hardware.sane.configDir;
     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; };
 
   enabled = config.hardware.sane.enable || config.services.saned.enable;
@@ -72,6 +81,15 @@ in
       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 {
       type = types.bool;
       default = false;