2015-12-14 17:23:29 +00:00
|
|
|
{ stdenv, fetchurl
|
2016-01-25 02:43:02 +00:00
|
|
|
, avahi, libjpeg, libusb1, libv4l, net_snmp
|
2015-12-17 04:04:22 +00:00
|
|
|
, gettext, pkgconfig
|
2015-12-26 18:48:33 +00:00
|
|
|
|
|
|
|
# List of { src name backend } attibute sets - see installFirmware below:
|
|
|
|
, extraFirmware ? []
|
|
|
|
|
|
|
|
# For backwards compatibility with older setups; use extraFirmware instead:
|
2015-12-14 02:39:08 +00:00
|
|
|
, gt68xxFirmware ? null, snapscanFirmware ? null
|
2015-12-26 18:48:33 +00:00
|
|
|
|
|
|
|
# Passed from versioned package (e.g. default.nix, git.nix):
|
2015-12-20 20:44:23 +00:00
|
|
|
, version, src, ...
|
2013-11-09 13:35:35 +00:00
|
|
|
}:
|
2012-11-26 15:17:31 +00:00
|
|
|
|
2015-12-20 20:44:23 +00:00
|
|
|
stdenv.mkDerivation {
|
2016-01-25 19:08:34 +00:00
|
|
|
inherit src version;
|
2012-11-26 15:17:31 +00:00
|
|
|
|
2015-12-20 20:44:23 +00:00
|
|
|
name = "sane-backends-${version}";
|
2012-11-26 15:17:31 +00:00
|
|
|
|
2015-08-27 15:24:42 +00:00
|
|
|
outputs = [ "out" "doc" "man" ];
|
|
|
|
|
2015-12-14 17:23:29 +00:00
|
|
|
configureFlags = []
|
|
|
|
++ stdenv.lib.optional (avahi != null) "--enable-avahi"
|
2015-12-17 15:39:08 +00:00
|
|
|
++ stdenv.lib.optional (libusb1 != null) "--enable-libusb_1_0"
|
|
|
|
;
|
2013-09-25 18:15:27 +00:00
|
|
|
|
2015-12-17 15:39:08 +00:00
|
|
|
buildInputs = [ avahi libusb1 libv4l net_snmp ];
|
2015-12-17 04:04:22 +00:00
|
|
|
nativeBuildInputs = [ gettext pkgconfig ];
|
2007-08-08 20:33:36 +00:00
|
|
|
|
2015-12-26 18:48:33 +00: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 14:56:05 +00: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
|
2016-02-05 13:49:27 +00:00
|
|
|
# the created 49-libsane references /bin/sh
|
|
|
|
substituteInPlace $out/etc/udev/rules.d/49-libsane.rules \
|
2016-02-08 23:13:07 +00:00
|
|
|
--replace "RUN+=\"/bin/sh" "RUN+=\"${stdenv.shell}"
|
2016-01-25 02:43:02 +00:00
|
|
|
|
|
|
|
substituteInPlace $out/lib/libsane.la \
|
2016-04-16 17:36:50 +00:00
|
|
|
--replace "-ljpeg" "-L${libjpeg.out}/lib -ljpeg"
|
2015-12-26 18:48:33 +00:00
|
|
|
'' + stdenv.lib.concatStrings (builtins.map installFirmware compatFirmware);
|
2012-11-26 15:17:31 +00:00
|
|
|
|
2015-12-05 19:27:52 +00:00
|
|
|
meta = with stdenv.lib; {
|
2015-12-05 21:27:27 +00: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 20:44:23 +00:00
|
|
|
homepage = "http://www.sane-project.org/";
|
2015-12-05 19:27:52 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2012-11-26 15:17:31 +00:00
|
|
|
|
2016-05-16 20:30:20 +00:00
|
|
|
maintainers = with maintainers; [ nckx peti ];
|
2015-12-05 19:27:52 +00:00
|
|
|
platforms = platforms.linux;
|
2012-11-26 15:17:31 +00:00
|
|
|
};
|
2005-11-03 17:20:38 +00:00
|
|
|
}
|