summary refs log tree commit diff
path: root/pkgs/applications/graphics/sane/backends/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/graphics/sane/backends/default.nix')
-rw-r--r--pkgs/applications/graphics/sane/backends/default.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/pkgs/applications/graphics/sane/backends/default.nix b/pkgs/applications/graphics/sane/backends/default.nix
index 821a97e3587..3d3c752dcde 100644
--- a/pkgs/applications/graphics/sane/backends/default.nix
+++ b/pkgs/applications/graphics/sane/backends/default.nix
@@ -2,12 +2,16 @@
 , gettext, pkg-config, python3
 , avahi, libgphoto2, libieee1284, libjpeg, libpng, libtiff, libusb1, libv4l, net-snmp
 , curl, systemd, libxml2, poppler
+, sane-drivers
 
 # List of { src name backend } attibute sets - see installFirmware below:
 , extraFirmware ? []
 
 # For backwards compatibility with older setups; use extraFirmware instead:
 , gt68xxFirmware ? null, snapscanFirmware ? null
+
+# Not included by default, scan snap drivers require fetching of unfree binaries.
+, scanSnapDriversUnfree ? false, scanSnapDriversPackage ? sane-drivers.epjitsu
 }:
 
 stdenv.mkDerivation {
@@ -88,7 +92,14 @@ stdenv.mkDerivation {
 
     # net.conf conflicts with the file generated by the nixos module
     rm $out/etc/sane.d/net.conf
-  '' + lib.concatStrings (builtins.map installFirmware compatFirmware);
+
+  ''
+  + lib.optionalString scanSnapDriversUnfree ''
+    # the ScanSnap drivers live under the epjitsu subdirectory, which was already created by the build but is empty.
+    rmdir $out/share/sane/epjitsu
+    ln -svT ${scanSnapDriversPackage} $out/share/sane/epjitsu
+  ''
+  + lib.concatStrings (builtins.map installFirmware compatFirmware);
 
   meta = with lib; {
     description = "SANE (Scanner Access Now Easy) backends";