2015-12-14 18:23:29 +01:00
|
|
|
{ stdenv, fetchurl
|
2015-12-17 16:39:08 +01:00
|
|
|
, avahi, libusb1, libv4l, net_snmp
|
2015-12-17 05:04:22 +01:00
|
|
|
, gettext, pkgconfig
|
2015-12-26 19:48:33 +01:00
|
|
|
|
|
|
|
# List of { src name backend } attibute sets - see installFirmware below:
|
|
|
|
, extraFirmware ? []
|
|
|
|
|
|
|
|
# For backwards compatibility with older setups; use extraFirmware instead:
|
2015-12-14 03:39:08 +01:00
|
|
|
, gt68xxFirmware ? null, snapscanFirmware ? null
|
2015-12-26 19:48:33 +01:00
|
|
|
|
|
|
|
# Passed from versioned package (e.g. default.nix, git.nix):
|
2015-12-20 21:44:23 +01:00
|
|
|
, version, src, ...
|
2013-11-09 14:35:35 +01:00
|
|
|
}:
|
2012-11-26 16:17:31 +01:00
|
|
|
|
2015-12-20 21:44:23 +01:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
inherit src;
|
2012-11-26 16:17:31 +01:00
|
|
|
|
2015-12-20 21:44:23 +01:00
|
|
|
name = "sane-backends-${version}";
|
2012-11-26 16:17:31 +01:00
|
|
|
|
2015-08-27 17:24:42 +02:00
|
|
|
outputs = [ "out" "doc" "man" ];
|
|
|
|
|
2015-12-14 18:23:29 +01:00
|
|
|
configureFlags = []
|
|
|
|
++ stdenv.lib.optional (avahi != null) "--enable-avahi"
|
2015-12-17 16:39:08 +01:00
|
|
|
++ stdenv.lib.optional (libusb1 != null) "--enable-libusb_1_0"
|
|
|
|
;
|
2013-09-25 20:15:27 +02:00
|
|
|
|
2015-12-17 16:39:08 +01:00
|
|
|
buildInputs = [ avahi libusb1 libv4l net_snmp ];
|
2015-12-17 05:04:22 +01:00
|
|
|
nativeBuildInputs = [ gettext pkgconfig ];
|
2007-08-08 22:33:36 +02:00
|
|
|
|
2015-12-26 19:48:33 +01:00
|
|
|
postInstall = let
|
|
|
|
|
|
|
|
compatFirmware = extraFirmware
|
|
|
|
++ stdenv.lib.optional (gt68xxFirmware != null) {
|
|
|
|
src = gt68xxFirmware.fw;
|
|
|
|
inherit (gt68xxFirmware) name;
|
|
|
|
backend = "gt68xx";
|
|
|
|
}
|
|
|
|
++ stdenv.lib.optional (snapscanFirmware != null) {
|
|
|
|
src = snapscanFirmware;
|
|
|
|
name = "your-firmwarefile.bin";
|
|
|
|
backend = "snapscan";
|
|
|
|
};
|
|
|
|
|
|
|
|
installFirmware = f: ''
|
|
|
|
mkdir -p $out/share/sane/${f.backend}
|
|
|
|
ln -sv ${f.src} $out/share/sane/${f.backend}/${f.name}
|
|
|
|
'';
|
|
|
|
|
|
|
|
in ''
|
2015-12-25 15:56:05 +01:00
|
|
|
mkdir -p $out/etc/udev/rules.d/
|
|
|
|
./tools/sane-desc -m udev > $out/etc/udev/rules.d/49-libsane.rules || \
|
|
|
|
cp tools/udev/libsane.rules $out/etc/udev/rules.d/49-libsane.rules
|
2015-12-26 19:48:33 +01:00
|
|
|
'' + stdenv.lib.concatStrings (builtins.map installFirmware compatFirmware);
|
2012-11-26 16:17:31 +01:00
|
|
|
|
2015-12-05 20:27:52 +01:00
|
|
|
meta = with stdenv.lib; {
|
2015-12-20 21:44:23 +01:00
|
|
|
inherit version;
|
|
|
|
|
2015-12-05 22:27:27 +01:00
|
|
|
description = "SANE (Scanner Access Now Easy) backends";
|
|
|
|
longDescription = ''
|
|
|
|
Collection of open-source SANE backends (device drivers).
|
|
|
|
SANE is a universal scanner interface providing standardized access to
|
|
|
|
any raster image scanner hardware: flatbed scanners, hand-held scanners,
|
|
|
|
video- and still-cameras, frame-grabbers, etc. For a list of supported
|
|
|
|
scanners, see http://www.sane-project.org/sane-backends.html.
|
|
|
|
'';
|
2015-12-20 21:44:23 +01:00
|
|
|
homepage = "http://www.sane-project.org/";
|
2015-12-05 20:27:52 +01:00
|
|
|
license = licenses.gpl2Plus;
|
2012-11-26 16:17:31 +01:00
|
|
|
|
2015-12-05 20:27:52 +01:00
|
|
|
maintainers = with maintainers; [ nckx simons ];
|
|
|
|
platforms = platforms.linux;
|
2012-11-26 16:17:31 +01:00
|
|
|
};
|
2005-11-03 18:20:38 +01:00
|
|
|
}
|