summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2021-07-30 14:58:39 +0200
committerProfpatsch <mail@profpatsch.de>2021-08-01 13:45:46 +0200
commit6376458424433ced446cbb9045641cb23c9b832d (patch)
tree195d14c9078269ff8a38e31c378dc5128ce59f1e /nixos
parentcc2c11d54395a1a7972bd8c87512ec1610824c43 (diff)
downloadnixpkgs-6376458424433ced446cbb9045641cb23c9b832d.tar
nixpkgs-6376458424433ced446cbb9045641cb23c9b832d.tar.gz
nixpkgs-6376458424433ced446cbb9045641cb23c9b832d.tar.bz2
nixpkgs-6376458424433ced446cbb9045641cb23c9b832d.tar.lz
nixpkgs-6376458424433ced446cbb9045641cb23c9b832d.tar.xz
nixpkgs-6376458424433ced446cbb9045641cb23c9b832d.tar.zst
nixpkgs-6376458424433ced446cbb9045641cb23c9b832d.zip
sane: Add support for the unfree Fujitsu ScanSnap drivers
This adds the scanner files already linked from the
`etc/sane.d/epjitsu.conf` file, which are extracted from the Windows
drivers and mirrored on GitHub.

Being a Japanese hardware vendor, Fujitsu’s software release &
licensing methods are horrifying, but their scanners are some of the
best, so we should definitly have discoverable support for them, which
this patch hopefully adds.

Inspiration was taken from the following sources:
https://www.josharcher.uk/code/install-scansnap-s1300-drivers-linux/
https://ubuntuforums.org/archive/index.php/t-1461915.html
https://github.com/stevleibelt/scansnap-firmware
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/hardware/sane.nix27
1 files changed, 26 insertions, 1 deletions
diff --git a/nixos/modules/services/hardware/sane.nix b/nixos/modules/services/hardware/sane.nix
index 8c1bde7b415..ccf726bd182 100644
--- a/nixos/modules/services/hardware/sane.nix
+++ b/nixos/modules/services/hardware/sane.nix
@@ -4,7 +4,10 @@ with lib;
 
 let
 
-  pkg = pkgs.sane-backends;
+  pkg = pkgs.sane-backends.override {
+    scanSnapDriversUnfree = config.hardware.sane.drivers.scanSnap.enable;
+    scanSnapDriversPackage = config.hardware.sane.drivers.scanSnap.package;
+  };
 
   sanedConf = pkgs.writeTextFile {
     name = "saned.conf";
@@ -98,6 +101,28 @@ in
       '';
     };
 
+    hardware.sane.drivers.scanSnap.enable = mkOption {
+      type = types.bool;
+      default = false;
+      example = true;
+      description = ''
+        Whether to enable drivers for the Fujitsu ScanSnap scanners.
+
+        The driver files are unfree and extracted from the Windows driver image.
+      '';
+    };
+
+    hardware.sane.drivers.scanSnap.package = mkOption {
+      type = types.package;
+      default = pkgs.sane-drivers.epjitsu;
+      description = ''
+        Epjitsu driver package to use. Useful if you want to extract the driver files yourself.
+
+        The process is described in the <literal>/etc/sane.d/epjitsu.conf</literal> file in
+        the <literal>sane-backends</literal> package.
+      '';
+    };
+
     services.saned.enable = mkOption {
       type = types.bool;
       default = false;