diff options
author | Profpatsch <mail@profpatsch.de> | 2021-07-30 14:58:39 +0200 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2021-08-01 13:45:46 +0200 |
commit | 6376458424433ced446cbb9045641cb23c9b832d (patch) | |
tree | 195d14c9078269ff8a38e31c378dc5128ce59f1e | |
parent | cc2c11d54395a1a7972bd8c87512ec1610824c43 (diff) | |
download | nixpkgs-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
-rw-r--r-- | nixos/modules/services/hardware/sane.nix | 27 | ||||
-rw-r--r-- | pkgs/applications/graphics/sane/backends/default.nix | 13 | ||||
-rw-r--r-- | pkgs/applications/graphics/sane/drivers.nix | 13 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
4 files changed, 53 insertions, 2 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; 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"; diff --git a/pkgs/applications/graphics/sane/drivers.nix b/pkgs/applications/graphics/sane/drivers.nix new file mode 100644 index 00000000000..9f1a644f4fa --- /dev/null +++ b/pkgs/applications/graphics/sane/drivers.nix @@ -0,0 +1,13 @@ +{ lib, fetchFromGitHub }: + +{ + # Fujitsu ScanSnap + epjitsu = fetchFromGitHub { + name = "scansnap-firmware"; + owner = "stevleibelt"; + repo = "scansnap-firmware"; + rev = "96c3a8b2a4e4f1ccc4e5827c5eb5598084fd17c8"; + sha256 = "1inchnvaqyw9d0skpg8hp5rpn27c09q58lsr42by4bahpbx5qday"; + meta.license = lib.licenses.unfree; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1fb91e0c20e..63c64bb3e3b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -31830,6 +31830,8 @@ in sane-backends = callPackage ../applications/graphics/sane/backends (config.sane or {}); + sane-drivers = callPackage ../applications/graphics/sane/drivers.nix {}; + senv = callPackage ../applications/misc/senv { }; brlaser = callPackage ../misc/cups/drivers/brlaser { }; |