From c20cd1834f675153f87bb8544053b4069688f0c8 Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Fri, 19 Feb 2021 18:04:09 +0100 Subject: [PATCH] sane-backends: 1.0.30 -> 1.0.32 sane-backends-git: remove, it's not updated often enough to be useful --- nixos/modules/services/hardware/sane.nix | 4 +- .../graphics/sane/backends/default.nix | 109 +++++++++++++++++- .../graphics/sane/backends/generic.nix | 95 --------------- .../graphics/sane/backends/git.nix | 10 -- pkgs/top-level/aliases.nix | 3 +- pkgs/top-level/all-packages.nix | 2 - 6 files changed, 106 insertions(+), 117 deletions(-) delete mode 100644 pkgs/applications/graphics/sane/backends/generic.nix delete mode 100644 pkgs/applications/graphics/sane/backends/git.nix diff --git a/nixos/modules/services/hardware/sane.nix b/nixos/modules/services/hardware/sane.nix index 03070a8f9e7c..29e5fbaee6bc 100644 --- a/nixos/modules/services/hardware/sane.nix +++ b/nixos/modules/services/hardware/sane.nix @@ -4,9 +4,7 @@ with lib; let - pkg = if config.hardware.sane.snapshot - then pkgs.sane-backends-git - else pkgs.sane-backends; + pkg = pkgs.sane-backends; sanedConf = pkgs.writeTextFile { name = "saned.conf"; diff --git a/pkgs/applications/graphics/sane/backends/default.nix b/pkgs/applications/graphics/sane/backends/default.nix index ad2681d25fe5..821a97e35871 100644 --- a/pkgs/applications/graphics/sane/backends/default.nix +++ b/pkgs/applications/graphics/sane/backends/default.nix @@ -1,10 +1,107 @@ -{ callPackage, fetchurl, ... } @ args: +{ stdenv, lib, fetchurl, runtimeShell +, gettext, pkg-config, python3 +, avahi, libgphoto2, libieee1284, libjpeg, libpng, libtiff, libusb1, libv4l, net-snmp +, curl, systemd, libxml2, poppler -callPackage ./generic.nix (args // rec { - version = "1.0.30"; +# List of { src name backend } attibute sets - see installFirmware below: +, extraFirmware ? [] + +# For backwards compatibility with older setups; use extraFirmware instead: +, gt68xxFirmware ? null, snapscanFirmware ? null +}: + +stdenv.mkDerivation { + pname = "sane-backends"; + version = "1.0.32"; src = fetchurl { - url = "https://gitlab.com/sane-project/backends/uploads/c3dd60c9e054b5dee1e7b01a7edc98b0/sane-backends-${version}.tar.gz"; - sha256 = "18vryaycps3zpjzxh0wjgg8nv2f4pdvcfxxmdfj28qbzqjlrcp9z"; + # raw checkouts of the repo do not work because, the configure script is + # only functional in manually uploaded release tarballs. + # https://gitlab.com/sane-project/backends/-/issues/440 + # unfortunately this make the url unpredictable on update, to find the link + # go to https://gitlab.com/sane-project/backends/-/releases and choose + # the link with other in the URL. + url = "https://gitlab.com/sane-project/backends/uploads/104f09c07d35519cc8e72e604f11643f/sane-backends-1.0.32.tar.gz"; + sha256 = "055iicihxa6b28iv5fnz13n67frdr5nrydq2c846f9x7q0vw4a1s"; }; -}) + + outputs = [ "out" "doc" "man" ]; + + nativeBuildInputs = [ + gettext + pkg-config + python3 + ]; + + buildInputs = [ + avahi + libgphoto2 + libieee1284 + libjpeg + libpng + libtiff + libusb1 + libv4l + net-snmp + curl + systemd + libxml2 + poppler + ]; + + enableParallelBuilding = true; + + configureFlags = + lib.optional (avahi != null) "--with-avahi" + ++ lib.optional (libusb1 != null) "--with-usb" + ; + + postInstall = let + + compatFirmware = extraFirmware + ++ lib.optional (gt68xxFirmware != null) { + src = gt68xxFirmware.fw; + inherit (gt68xxFirmware) name; + backend = "gt68xx"; + } + ++ 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 '' + 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 + # the created 49-libsane references /bin/sh + substituteInPlace $out/etc/udev/rules.d/49-libsane.rules \ + --replace "RUN+=\"/bin/sh" "RUN+=\"${runtimeShell}" + + substituteInPlace $out/lib/libsane.la \ + --replace "-ljpeg" "-L${lib.getLib libjpeg}/lib -ljpeg" + + # net.conf conflicts with the file generated by the nixos module + rm $out/etc/sane.d/net.conf + '' + lib.concatStrings (builtins.map installFirmware compatFirmware); + + meta = with lib; { + 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. + ''; + homepage = "http://www.sane-project.org/"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ peti ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/applications/graphics/sane/backends/generic.nix b/pkgs/applications/graphics/sane/backends/generic.nix deleted file mode 100644 index 88d47b58932a..000000000000 --- a/pkgs/applications/graphics/sane/backends/generic.nix +++ /dev/null @@ -1,95 +0,0 @@ -{ lib, stdenv -, gettext, pkg-config -, avahi, libgphoto2, libieee1284, libjpeg, libpng, libtiff, libusb1, libv4l, net-snmp - -# List of { src name backend } attibute sets - see installFirmware below: -, extraFirmware ? [] - -# For backwards compatibility with older setups; use extraFirmware instead: -, gt68xxFirmware ? null, snapscanFirmware ? null - -# Passed from versioned package (e.g. default.nix, git.nix): -, version, src, ... -}: - -stdenv.mkDerivation { - inherit src version; - - name = "sane-backends-${version}"; - - outputs = [ "out" "doc" "man" ]; - - nativeBuildInputs = [ - gettext - pkg-config - ]; - - buildInputs = [ - avahi - libgphoto2 - libieee1284 - libjpeg - libpng - libtiff - libusb1 - libv4l - net-snmp - ]; - - enableParallelBuilding = true; - - configureFlags = [] - ++ lib.optional (avahi != null) "--enable-avahi" - ++ lib.optional (libusb1 != null) "--with-usb" - ; - - postInstall = let - - compatFirmware = extraFirmware - ++ lib.optional (gt68xxFirmware != null) { - src = gt68xxFirmware.fw; - inherit (gt68xxFirmware) name; - backend = "gt68xx"; - } - ++ 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 '' - 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 - # the created 49-libsane references /bin/sh - substituteInPlace $out/etc/udev/rules.d/49-libsane.rules \ - --replace "RUN+=\"/bin/sh" "RUN+=\"${stdenv.shell}" - - substituteInPlace $out/lib/libsane.la \ - --replace "-ljpeg" "-L${libjpeg.out}/lib -ljpeg" - - # net.conf conflicts with the file generated by the nixos module - rm -f $out/etc/sane.d/net.conf - '' + lib.concatStrings (builtins.map installFirmware compatFirmware); - - meta = with lib; { - 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. - ''; - homepage = "http://www.sane-project.org/"; - license = licenses.gpl2Plus; - - maintainers = with maintainers; [ peti ]; - platforms = platforms.linux; - }; -} diff --git a/pkgs/applications/graphics/sane/backends/git.nix b/pkgs/applications/graphics/sane/backends/git.nix deleted file mode 100644 index 2edd739068d9..000000000000 --- a/pkgs/applications/graphics/sane/backends/git.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ callPackage, fetchgit, ... } @ args: - -callPackage ./generic.nix (args // { - version = "2017-12-01"; - src = fetchgit { - sha256 = "0qf7d7268kdxnb723c03m6icxhbgx0vw8gqvck2q1w5b948dy9g8"; - rev = "e895ee55bec8a3320a0e972b32c05d35b47fe226"; - url = "https://gitlab.com/sane-project/backends.git"; - }; -}) diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index b2ff3e93c3a7..f0f01a01bfa5 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -635,7 +635,8 @@ mapAliases ({ sambaMaster = throw "sambaMaster was removed in 2019-09-13: outdated and no longer needed"; samsungUnifiedLinuxDriver = samsung-unified-linux-driver; # added 2016-01-25 saneBackends = sane-backends; # added 2016-01-02 - saneBackendsGit = sane-backends-git; # added 2016-01-02 + saneBackendsGit = sane-backends; # added 2016-01-02 + sane-backends-git = sane-backends; # added 2021-02-19 saneFrontends = sane-frontends; # added 2016-01-02 sapic = throw "sapic was deprecated on 2019-1-19: sapic is bundled with 'tamarin-prover' now"; scaff = throw "scaff is deprecated - replaced by https://gitlab.com/jD91mZM2/inc (not in nixpkgs yet)"; # added 2020-03-01 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3b7831d87960..a3f097814cd3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -29677,8 +29677,6 @@ in sane-backends = callPackage ../applications/graphics/sane/backends (config.sane or {}); - sane-backends-git = callPackage ../applications/graphics/sane/backends/git.nix (config.sane or {}); - senv = callPackage ../applications/misc/senv { }; brlaser = callPackage ../misc/cups/drivers/brlaser { };