about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@gmail.com>2014-05-11 13:31:21 -0500
committerThomas Tuegel <ttuegel@gmail.com>2014-05-11 14:01:07 -0500
commit8df521bf0f73d2ac6a01aa912725b30d78973bcc (patch)
treee0c495f3315eae207127034f155d2e8049cb7e04 /nixos/modules/services
parent4fb9c3700a2fcb5132994e8ecbbe07dc3574f9ab (diff)
downloadnixlib-8df521bf0f73d2ac6a01aa912725b30d78973bcc.tar
nixlib-8df521bf0f73d2ac6a01aa912725b30d78973bcc.tar.gz
nixlib-8df521bf0f73d2ac6a01aa912725b30d78973bcc.tar.bz2
nixlib-8df521bf0f73d2ac6a01aa912725b30d78973bcc.tar.lz
nixlib-8df521bf0f73d2ac6a01aa912725b30d78973bcc.tar.xz
nixlib-8df521bf0f73d2ac6a01aa912725b30d78973bcc.tar.zst
nixlib-8df521bf0f73d2ac6a01aa912725b30d78973bcc.zip
sane: use mkSaneConfig to set system environment
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/hardware/sane.nix16
1 files changed, 14 insertions, 2 deletions
diff --git a/nixos/modules/services/hardware/sane.nix b/nixos/modules/services/hardware/sane.nix
index 01d910575bb5..56e28b50350b 100644
--- a/nixos/modules/services/hardware/sane.nix
+++ b/nixos/modules/services/hardware/sane.nix
@@ -5,6 +5,8 @@ with lib;
 let
 
   pkg = if config.hardware.sane.snapshot then pkgs.saneBackendsGit else pkgs.saneBackends;
+  backends = [ pkg ] ++ config.hardware.sane.extraBackends;
+  saneConfig = pkgs.mkSaneConfig { paths = backends; };
 
 in
 
@@ -26,6 +28,12 @@ in
       description = "Use a development snapshot of SANE scanner drivers.";
     };
 
+    hardware.sane.extraBackends = mkOption {
+      type = types.listOf types.path;
+      default = [];
+      description = "Packages providing extra SANE backends to enable.";
+    };
+
   };
 
 
@@ -33,8 +41,12 @@ in
 
   config = mkIf config.hardware.sane.enable {
 
-    environment.systemPackages = [ pkg ];
-    services.udev.packages = [ pkg ];
+    environment.systemPackages = backends;
+    environment.variables = {
+      SANE_CONFIG_DIR = "${saneConfig}/etc/sane.d";
+      LD_LIBRARY_PATH = [ "${saneConfig}/lib/sane" ];
+    };
+    services.udev.packages = backends;
 
     users.extraGroups."scanner".gid = config.ids.gids.scanner;