nixpkgs/pkgs/misc/drivers/epkowa/default.nix

385 lines
13 KiB
Nix
Raw Normal View History

2021-01-15 13:21:58 +00:00
{ lib, stdenv
, fetchurl
, fetchpatch
, makeWrapper
, symlinkJoin
2021-01-17 02:30:45 +00:00
, pkg-config
, libtool
, gtk2
, libxml2
, libxslt
, libusb-compat-0_1
, sane-backends
, rpm
, cpio
, getopt
, autoPatchelfHook
, gcc
2017-05-26 21:05:43 +01:00
}:
let common_meta = {
homepage = "http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX";
2021-01-15 13:21:58 +00:00
license = with lib.licenses; epson;
platforms = with lib.platforms; linux;
};
2017-05-26 21:05:43 +01:00
in
############################
#
# PLUGINS
#
############################
# adding a plugin for another printer shouldn't be too difficult, but you need the firmware to test...
let plugins = {
v330 = stdenv.mkDerivation rec {
name = "iscan-v330-bundle";
2019-09-08 18:39:21 +01:00
version = "2.30.4";
src = fetchurl {
# To find new versions, visit
# http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX and search for
# some printer like for instance "WF-7210" to get to the most recent
# version.
# NOTE: Don't forget to update the webarchive link too!
urls = [
"https://download2.ebz.epson.net/iscan/plugin/perfection-v330/rpm/x64/iscan-perfection-v330-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/perfection-v330/rpm/x64/iscan-perfection-v330-bundle-${version}.x64.rpm.tar.gz"
];
2020-08-05 19:23:30 +01:00
sha256 = "056c04pfsf98nnknphg28l489isqb6y4l2c8g7wqhclwgj7m338i";
};
2019-09-08 18:39:21 +01:00
nativeBuildInputs = [ autoPatchelfHook rpm ];
installPhase = ''
2019-09-08 18:39:21 +01:00
${rpm}/bin/rpm2cpio plugins/esci-interpreter-perfection-v330-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
mkdir $out{,/share,/lib}
cp -r ./usr/share/{iscan-data,esci}/ $out/share/
cp -r ./usr/lib64/esci $out/lib
'';
passthru = {
registrationCommand = ''
$registry --add interpreter usb 0x04b8 0x0142 "$plugin/lib/esci/libesci-interpreter-perfection-v330 $plugin/share/esci/esfwad.bin"
'';
hw = "Perfection V330 Photo";
};
meta = common_meta // { description = "Plugin to support " + passthru.hw + " scanner in sane"; };
};
v370 = stdenv.mkDerivation rec {
name = "iscan-v370-bundle";
version = "2.30.4";
src = fetchurl {
urls = [
"https://download2.ebz.epson.net/iscan/plugin/perfection-v370/rpm/x64/iscan-perfection-v370-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/perfection-v370/rpm/x64/iscan-perfection-v370-bundle-${version}.x64.rpm.tar.gz"
];
sha256 = "1ff7adp9mha1i2ibllz540xkagpy8r757h4s3h60bgxbyzv2yggr";
};
nativeBuildInputs = [ autoPatchelfHook rpm ];
installPhase = ''
cd plugins
${rpm}/bin/rpm2cpio iscan-plugin-perfection-v370-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
mkdir -p $out/share $out/lib
cp -r usr/share/{iscan-data,iscan}/ $out/share
cp -r usr/lib64/iscan $out/lib
mv $out/share/iscan $out/share/esci
mv $out/lib/iscan $out/lib/esci
'';
passthru = {
registrationCommand = ''
$registry --add interpreter usb 0x04b8 0x014a "$plugin/lib/esci/libiscan-plugin-perfection-v370 $plugin/share/esci/esfwdd.bin"
'';
hw = "Perfection V37/V370";
};
meta = common_meta // { description = "Plugin to support " + passthru.hw + " scanner in sane"; };
};
v600 = stdenv.mkDerivation rec {
pname = "iscan-gt-x820-bundle";
version = "2.30.4";
nativeBuildInputs = [ autoPatchelfHook rpm ];
src = fetchurl {
urls = [
"https://download2.ebz.epson.net/iscan/plugin/gt-x820/rpm/x64/iscan-gt-x820-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/gt-x820/rpm/x64/iscan-gt-x820-bundle-${version}.x64.rpm.tar.gz"
];
sha256 = "1vlba7dsgpk35nn3n7is8nwds3yzlk38q43mppjzwsz2d2n7sr33";
};
installPhase = ''
cd plugins
${rpm}/bin/rpm2cpio iscan-plugin-gt-x820-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
mkdir $out
cp -r usr/share $out
cp -r usr/lib64 $out/lib
mv $out/share/iscan $out/share/esci
mv $out/lib/iscan $out/lib/esci
'';
passthru = {
registrationCommand = ''
$registry --add interpreter usb 0x04b8 0x013a "$plugin/lib/esci/libesintA1 $plugin/share/esci/esfwA1.bin"
'';
hw = "Perfection V600 Photo";
};
meta = common_meta // { description = "iscan esci x820 plugin for " + passthru.hw; };
};
x770 = stdenv.mkDerivation rec {
2018-11-05 16:38:20 +00:00
pname = "iscan-gt-x770-bundle";
2019-09-08 18:39:21 +01:00
version = "2.30.4";
2018-06-23 16:04:21 +01:00
2019-09-08 18:39:21 +01:00
nativeBuildInputs = [ autoPatchelfHook rpm ];
2018-06-23 16:04:21 +01:00
src = fetchurl {
urls = [
"https://download2.ebz.epson.net/iscan/plugin/gt-x770/rpm/x64/iscan-gt-x770-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/gt-x770/rpm/x64/iscan-gt-x770-bundle-${version}.x64.rpm.tar.gz"
];
2020-08-05 19:23:30 +01:00
sha256 = "1chxdm6smv2d14pn2jl9xyd0vr42diy7vpskd3b9a61gf5h3gj03";
2018-06-23 16:04:21 +01:00
};
installPhase = ''
cd plugins
2019-09-08 18:39:21 +01:00
${rpm}/bin/rpm2cpio iscan-plugin-gt-x770-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
2018-06-23 16:04:21 +01:00
mkdir $out
cp -r usr/share $out
cp -r usr/lib64 $out/lib
mv $out/share/iscan $out/share/esci
mv $out/lib/iscan $out/lib/esci
'';
2018-06-23 16:04:21 +01:00
passthru = {
registrationCommand = ''
$registry --add interpreter usb 0x04b8 0x0130 "$plugin/lib/esci/libesint7C $plugin/share/esci/esfw7C.bin"
'';
2018-06-23 16:04:21 +01:00
hw = "Perfection V500 Photo";
};
meta = common_meta // { description = "iscan esci x770 plugin for " + passthru.hw; };
};
2017-05-26 21:05:43 +01:00
f720 = stdenv.mkDerivation rec {
2018-11-05 16:38:20 +00:00
pname = "iscan-gt-f720-bundle";
2019-09-08 18:39:21 +01:00
version = "2.30.4";
2017-05-26 21:05:43 +01:00
nativeBuildInputs = [ autoPatchelfHook ];
2019-09-08 18:39:21 +01:00
buildInputs = [ gcc.cc.lib ];
2017-05-26 21:05:43 +01:00
src = fetchurl {
urls = [
"https://download2.ebz.epson.net/iscan/plugin/gt-f720/rpm/x64/iscan-gt-f720-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/gt-f720/rpm/x64/iscan-gt-f720-bundle-${version}.x64.rpm.tar.gz"
];
2020-08-05 19:23:30 +01:00
sha256 = "1xnbmb2rn610kqpg1x6k1cc13zlmx2f3l2xnj6809rnhg96qqn20";
2017-05-26 21:05:43 +01:00
};
installPhase = ''
cd plugins
2019-09-08 18:39:21 +01:00
${rpm}/bin/rpm2cpio esci-interpreter-gt-f720-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
2017-05-26 21:05:43 +01:00
mkdir $out
cp -r usr/share $out
cp -r usr/lib64 $out/lib
'';
2019-09-08 18:39:21 +01:00
2017-05-26 21:05:43 +01:00
passthru = {
registrationCommand = ''
$registry --add interpreter usb 0x04b8 0x0131 "$plugin/lib/esci/libesci-interpreter-gt-f720 $plugin/share/esci/esfw8b.bin"
'';
2017-05-26 21:05:43 +01:00
hw = "GT-F720, GT-S620, Perfection V30, Perfection V300 Photo";
};
2017-05-26 21:05:43 +01:00
meta = common_meta // { description = "iscan esci f720 plugin for " + passthru.hw; };
2017-05-26 21:05:43 +01:00
};
2019-01-19 23:21:28 +00:00
s80 = stdenv.mkDerivation rec {
pname = "iscan-gt-s80-bundle";
2019-09-08 18:39:21 +01:00
version = "2.30.4";
2019-01-19 23:21:28 +00:00
2019-09-08 18:39:21 +01:00
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [ gcc.cc.lib libtool ];
2019-01-19 23:21:28 +00:00
src = fetchurl {
urls = [
"https://download2.ebz.epson.net/iscan/plugin/gt-s80/rpm/x64/iscan-gt-s80-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/gt-s80/rpm/x64/iscan-gt-s80-bundle-${version}.x64.rpm.tar.gz"
];
2020-08-05 19:23:30 +01:00
sha256 = "00qfdgs03k7bbs67zjrk8hbxvlyinsmk890amp9cmpfjfzdxgg58";
2019-01-19 23:21:28 +00:00
};
installPhase = ''
cd plugins
2019-09-08 18:39:21 +01:00
${rpm}/bin/rpm2cpio esci-interpreter-gt-s80-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
${rpm}/bin/rpm2cpio iscan-plugin-esdip-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
2019-01-19 23:21:28 +00:00
mkdir $out
cp -r usr/share $out
cp -r usr/lib64 $out/lib
mkdir $out/share/esci
'';
2019-09-08 18:39:21 +01:00
2019-01-19 23:21:28 +00:00
passthru = {
registrationCommand = ''
$registry --add interpreter usb 0x04b8 0x0136 "$plugin/lib/esci/libesci-interpreter-gt-s80.so"
$registry --add interpreter usb 0x04b8 0x0137 "$plugin/lib/esci/libesci-interpreter-gt-s50.so"
$registry --add interpreter usb 0x04b8 0x0143 "$plugin/lib/esci/libesci-interpreter-gt-s50.so"
$registry --add interpreter usb 0x04b8 0x0144 "$plugin/lib/esci/libesci-interpreter-gt-s80.so"
'';
2019-01-19 23:21:28 +00:00
hw = "ES-D200, ED-D350, ES-D400, GT-S50, GT-S55, GT-S80, GT-S85";
};
2019-01-19 23:21:28 +00:00
meta = common_meta // { description = "iscan esci s80 plugin for " + passthru.hw; };
2019-01-19 23:21:28 +00:00
};
s650 = stdenv.mkDerivation rec {
name = "iscan-gt-s650-bundle";
version = "2.30.4";
src = fetchurl {
urls = [
"https://download2.ebz.epson.net/iscan/plugin/gt-s650/rpm/x64/iscan-gt-s650-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/gt-s650/rpm/x64/iscan-gt-s650-bundle-${version}.x64.rpm.tar.gz"
];
2020-08-05 19:23:30 +01:00
sha256 = "0fn4lz4g0a8l301v6yv7fwl37wgwhz5y90nf681f655xxc91hqh7";
};
nativeBuildInputs = [ autoPatchelfHook rpm ];
installPhase = ''
cd plugins
${rpm}/bin/rpm2cpio iscan-plugin-gt-s650-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
mkdir $out
cp -r usr/share $out
cp -r usr/lib64 $out/lib
mv $out/share/iscan $out/share/esci
mv $out/lib/iscan $out/lib/esci
'';
passthru = {
registrationCommand = ''
$registry --add interpreter usb 0x04b8 0x013c "$plugin/lib/esci/libiscan-plugin-gt-s650 $plugin/share/esci/esfw010c.bin"
$registry --add interpreter usb 0x04b8 0x013d "$plugin/lib/esci/libiscan-plugin-gt-s650 $plugin/share/esci/esfw010c.bin"
'';
hw = "GT-S650, Perfection V19, Perfection V39";
};
meta = common_meta // { description = "iscan GT-S650 for " + passthru.hw; };
};
network = stdenv.mkDerivation rec {
pname = "iscan-nt-bundle";
2019-09-08 18:39:21 +01:00
# for the version, look for the driver of XP-750 in the search page
version = "2.30.4";
buildInputs = [ stdenv.cc.cc.lib ];
nativeBuildInputs = [ autoPatchelfHook ];
src = fetchurl {
urls = [
"https://download2.ebz.epson.net/iscan/general/rpm/x64/iscan-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/general/rpm/x64/iscan-bundle-${version}.x64.rpm.tar.gz"
];
2020-08-05 19:23:30 +01:00
sha256 = "0jssigsgkxb9i7qa7db291a1gbvwl795i4ahvb7bnqp33czkj85k";
};
installPhase = ''
cd plugins
2019-09-08 18:39:21 +01:00
${rpm}/bin/rpm2cpio iscan-network-nt-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
mkdir $out
cp -r usr/share $out
cp -r usr/lib64 $out/lib
mkdir $out/share/esci
'';
passthru = {
registrationCommand = "";
hw = "network";
};
meta = common_meta // { description = "iscan network plugin"; };
};
2017-05-26 21:05:43 +01:00
};
in
let fwdir = symlinkJoin {
name = "esci-firmware-dir";
2021-01-15 13:21:58 +00:00
paths = lib.mapAttrsToList (name: value: value + /share/esci) plugins;
2017-05-26 21:05:43 +01:00
};
in
let iscan-data = stdenv.mkDerivation rec {
pname = "iscan-data";
version = "1.39.2-1";
2017-05-26 21:05:43 +01:00
src = fetchurl {
urls = [
"http://support.epson.net/linux/src/scanner/iscan/iscan-data_${version}.tar.gz"
"https://web.archive.org/web/http://support.epson.net/linux/src/scanner/iscan/iscan-data_${version}.tar.gz"
];
sha256 = "092qhlnjjgz11ifx6mng7mz20i44gc0nlccrbmw18xr5hipbqqka";
2017-05-26 21:05:43 +01:00
};
buildInputs = [
libxslt
];
meta = common_meta;
};
in
stdenv.mkDerivation rec {
pname = "iscan";
2019-09-08 18:39:21 +01:00
version = "2.30.4-2";
2017-05-26 21:05:43 +01:00
src = fetchurl {
urls = [
"http://support.epson.net/linux/src/scanner/iscan/iscan_${version}.tar.gz"
"https://web.archive.org/web/http://support.epson.net/linux/src/scanner/iscan/iscan_${version}.tar.gz"
];
2019-09-08 18:39:21 +01:00
sha256 = "1ma76jj0k3bz0fy06fiyl4di4y77rcryb0mwjmzs5ms2vq9rjysr";
2017-05-26 21:05:43 +01:00
};
nativeBuildInputs = [ pkg-config libtool makeWrapper ];
2017-05-26 21:05:43 +01:00
buildInputs = [
gtk2
libxml2
2020-04-28 04:29:39 +01:00
libusb-compat-0_1
2017-05-26 21:05:43 +01:00
sane-backends
];
patches = [
# Patch for compatibility with libpng versions greater than 10499
2017-05-26 21:05:43 +01:00
(fetchpatch {
urls = [
"https://gitweb.gentoo.org/repo/gentoo.git/plain/media-gfx/iscan/files/iscan-2.28.1.3+libpng-1.5.patch?h=b6e4c805d53b49da79a0f64ef16bb82d6d800fcf"
"https://web.archive.org/web/https://gitweb.gentoo.org/repo/gentoo.git/plain/media-gfx/iscan/files/iscan-2.28.1.3+libpng-1.5.patch?h=b6e4c805d53b49da79a0f64ef16bb82d6d800fcf"
];
2017-05-26 21:05:43 +01:00
sha256 = "04y70qjd220dpyh771fiq50lha16pms98mfigwjczdfmx6kpj1jd";
})
# Patch iscan to search appropriate folders for firmware files
2017-05-26 21:05:43 +01:00
./firmware_location.patch
# Patch deprecated use of sscanf code to use a more modern C99 compatible version
./sscanf.patch
];
patchFlags = [ "-p0" ];
2017-05-26 21:05:43 +01:00
configureFlags = [ "--enable-dependency-reduction" "--disable-frontend" ];
2017-05-26 21:05:43 +01:00
postConfigure = ''
echo '#define NIX_ESCI_PREFIX "'${fwdir}'"' >> config.h
'';
2017-05-26 21:05:43 +01:00
postInstall = ''
mkdir -p $out/etc/sane.d
cp backend/epkowa.conf $out/etc/sane.d
echo "epkowa" > $out/etc/sane.d/dll.conf
ln -s ${iscan-data}/share/iscan-data $out/share/iscan-data
mkdir -p $out/lib/iscan
ln -s ${plugins.network}/lib/iscan/network $out/lib/iscan/network
'';
2017-05-26 21:05:43 +01:00
postFixup = ''
# iscan-registry is a shell script requiring getopt
2018-06-24 16:36:11 +01:00
wrapProgram $out/bin/iscan-registry --prefix PATH : ${getopt}/bin
2017-05-26 21:05:43 +01:00
registry=$out/bin/iscan-registry;
'' +
2021-01-15 13:21:58 +00:00
lib.concatStrings (lib.mapAttrsToList
(name: value: ''
plugin=${value};
${value.passthru.registrationCommand}
'')
plugins);
2017-05-26 21:05:43 +01:00
meta = common_meta // {
description = "sane-epkowa backend for some epson scanners";
2017-05-26 21:05:43 +01:00
longDescription = ''
Includes gui-less iscan (aka. Image Scan! for Linux).
Supported hardware: at least :
'' +
2021-01-15 13:21:58 +00:00
lib.concatStringsSep ", " (lib.mapAttrsToList (name: value: value.passthru.hw) plugins);
maintainers = with lib.maintainers; [ symphorien dominikh ];
2017-05-26 21:05:43 +01:00
};
}