diff options
author | Tobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com> | 2015-12-20 21:44:23 +0100 |
---|---|---|
committer | Tobias Geerinckx-Rice <tobias.geerinckx.rice@gmail.com> | 2015-12-24 04:05:57 +0100 |
commit | 58bf69407125d47683e28502f01d0426660417a4 (patch) | |
tree | 93639af63300bc59b41fe6d4025fbb0a7ad18789 /pkgs/applications/graphics/sane | |
parent | ffc04a67e3aa54fdcf162dfdec9fc85535b5e251 (diff) |
saneBackends: factor out common code into generic.nix
The git version was duplicated from the stable one and the two had begun to diverge significantly. For example, commit 88d731925d62b162fc7b7b1bc8c75a519a9ac718 fixed a supposedly real bug — but only in the stable package. Factor out the shared code to avoid trouble — or worse, subtle differences or bugs — in future.
Diffstat (limited to 'pkgs/applications/graphics/sane')
-rw-r--r-- | pkgs/applications/graphics/sane/backends-git.nix | 64 | ||||
-rw-r--r-- | pkgs/applications/graphics/sane/backends/default.nix | 13 | ||||
-rw-r--r-- | pkgs/applications/graphics/sane/backends/generic.nix (renamed from pkgs/applications/graphics/sane/backends.nix) | 30 | ||||
-rw-r--r-- | pkgs/applications/graphics/sane/backends/git.nix | 10 |
4 files changed, 36 insertions, 81 deletions
diff --git a/pkgs/applications/graphics/sane/backends-git.nix b/pkgs/applications/graphics/sane/backends-git.nix deleted file mode 100644 index bf9f4f5c01fc4..0000000000000 --- a/pkgs/applications/graphics/sane/backends-git.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ stdenv, fetchurl, fetchgit -, avahi ? null, libusb ? null, net_snmp ? null -, gt68xxFirmware ? null, snapscanFirmware ? null -, hotplugSupport ? true -}: -let - firmware = gt68xxFirmware { inherit fetchurl; }; -in -assert hotplugSupport -> (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"); - -let version = "2015-12-20"; in -stdenv.mkDerivation { - name = "sane-backends-${version}"; - - src = fetchgit { - url = "git://alioth.debian.org/git/sane/sane-backends.git"; - rev = "5136e664b8608604f54a2cc1d466019922b311e6"; - sha256 = "998fdc9cdd3f9220c38244e0b87bba3ee623d7d20726479b04ed95b3836a37ed"; - }; - - udevSupport = hotplugSupport; - - buildInputs = [ avahi net_snmp ] - ++ stdenv.lib.optional (libusb != null) libusb; - - configureFlags = [] - ++ stdenv.lib.optional (avahi != null) "--enable-avahi"; - - postInstall = '' - if test "$udevSupport" = "1"; then - mkdir -p $out/etc/udev/rules.d/ - ./tools/sane-desc -m udev > $out/etc/udev/rules.d/60-libsane.rules || \ - cp tools/udev/libsane.rules $out/etc/udev/rules.d/60-libsane.rules - fi - ''; - - preInstall = - if gt68xxFirmware != null then - "mkdir -p \${out}/share/sane/gt68xx ; ln -s " + firmware.fw + - " \${out}/share/sane/gt68xx/" + firmware.name - else if snapscanFirmware != null then - "mkdir -p \${out}/share/sane/snapscan ; ln -s " + snapscanFirmware + - " \${out}/share/sane/snapscan/your-firmwarefile.bin ;" + - "mkdir -p \${out}/etc/sane.d ; " + - "echo epson2 > \${out}/etc/sane.d/dll.conf" - else ""; - - meta = with stdenv.lib; { - inherit version; - homepage = "http://www.sane-project.org/"; - 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. - ''; - license = licenses.gpl2Plus; - - maintainers = with maintainers; [ nckx simons ]; - platforms = platforms.linux; - }; -} diff --git a/pkgs/applications/graphics/sane/backends/default.nix b/pkgs/applications/graphics/sane/backends/default.nix new file mode 100644 index 0000000000000..a3ca7fdd55df6 --- /dev/null +++ b/pkgs/applications/graphics/sane/backends/default.nix @@ -0,0 +1,13 @@ +{ callPackage, fetchurl, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.0.25"; + src = fetchurl { + sha256 = "0b3fvhrxl4l82bf3v0j47ypjv6a0k5lqbgknrq1agpmjca6vmmx4"; + urls = [ + "http://pkgs.fedoraproject.org/repo/pkgs/sane-backends/sane-backends-${version}.tar.gz/f9ed5405b3c12f07c6ca51ee60225fe7/sane-backends-${version}.tar.gz" + "https://alioth.debian.org/frs/download.php/file/4146/sane-backends-${version}.tar.gz" + ]; + curlOpts = "--insecure"; + }; +}) diff --git a/pkgs/applications/graphics/sane/backends.nix b/pkgs/applications/graphics/sane/backends/generic.nix index 637ed7a202440..0324acec6c709 100644 --- a/pkgs/applications/graphics/sane/backends.nix +++ b/pkgs/applications/graphics/sane/backends/generic.nix @@ -1,40 +1,34 @@ { stdenv, fetchurl , avahi ? null, libusb ? null, libv4l ? null, net_snmp ? null -, pkgconfig ? null +, pkgconfig , gt68xxFirmware ? null, snapscanFirmware ? null , hotplugSupport ? true +, version, src, ... }: assert hotplugSupport -> (stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"); let + firmware = gt68xxFirmware { inherit fetchurl; }; + + udevSupport = hotplugSupport; + in -stdenv.mkDerivation rec { - version = "1.0.25"; - name = "sane-backends-${version}"; +stdenv.mkDerivation { + inherit src; - src = fetchurl { - urls = [ - "http://pkgs.fedoraproject.org/repo/pkgs/sane-backends/sane-backends-1.0.25.tar.gz/f9ed5405b3c12f07c6ca51ee60225fe7/${name}.tar.gz" - "https://alioth.debian.org/frs/download.php/file/4146/${name}.tar.gz" - ]; - curlOpts = "--insecure"; - sha256 = "0b3fvhrxl4l82bf3v0j47ypjv6a0k5lqbgknrq1agpmjca6vmmx4"; - }; + name = "sane-backends-${version}"; outputs = [ "out" "doc" "man" ]; - udevSupport = hotplugSupport; - configureFlags = [] ++ stdenv.lib.optional (avahi != null) "--enable-avahi" ++ stdenv.lib.optional (libusb != null) "--enable-libusb_1_0"; - buildInputs = [ avahi net_snmp ] + buildInputs = [ avahi net_snmp pkgconfig ] ++ stdenv.lib.optional (libusb != null) libusb ++ stdenv.lib.optional (libv4l != null) libv4l - ++ stdenv.lib.optional (pkgconfig != null) pkgconfig ; postInstall = '' @@ -55,7 +49,8 @@ stdenv.mkDerivation rec { else ""; meta = with stdenv.lib; { - homepage = "http://www.sane-project.org/"; + inherit version; + description = "SANE (Scanner Access Now Easy) backends"; longDescription = '' Collection of open-source SANE backends (device drivers). @@ -64,6 +59,7 @@ stdenv.mkDerivation rec { video- and still-cameras, frame-grabbers, etc. For a list of supported scanners, see http://www.sane-project.org/sane-backends.html. ''; + homepage = "http://www.sane-project.org/"; license = licenses.gpl2Plus; maintainers = with maintainers; [ nckx simons ]; diff --git a/pkgs/applications/graphics/sane/backends/git.nix b/pkgs/applications/graphics/sane/backends/git.nix new file mode 100644 index 0000000000000..7a76d8804d6cb --- /dev/null +++ b/pkgs/applications/graphics/sane/backends/git.nix @@ -0,0 +1,10 @@ +{ callPackage, fetchgit, ... } @ args: + +callPackage ./generic.nix (args // { + version = "2015-12-20"; + src = fetchgit { + sha256 = "998fdc9cdd3f9220c38244e0b87bba3ee623d7d20726479b04ed95b3836a37ed"; + rev = "5136e664b8608604f54a2cc1d466019922b311e6"; + url = "git://alioth.debian.org/git/sane/sane-backends.git"; + }; +}) |