Hi,
the expressions in sane-backends imply that there was an intent to ship
the udev rules that flag sane-recognized scanner devices for udev-acl,
so that ordinary users logged in at the console can scan. However, the
way this udev rule file is provided by sane-backends upstream has
changed: the file is not distributed verbatim, but a tool is built to
print the rules. I have updated the sane package to that effect.
I have also added a "snapshot" build of sane-backends, since my canon
lide 210 is substantially faster with the git snapshot than it is in the
latest release. Might be useful for others too.
Finally, to make use of the udev rules, I have added a module to nixos/,
so that folks can just say hardware.sane.enable = true instead of
learning about how to enable the udev rules manually.
Petr
Index: pkgs/misc/sane-backends/default.nix
===================================================================
--- pkgs/misc/sane-backends/default.nix (revision 30731)
+++ pkgs/misc/sane-backends/default.nix (working copy)
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, hotplugSupport ? false, libusb ? null
+{ stdenv, fetchurl, hotplugSupport ? true, libusb ? null
, gt68xxFirmware ? null }:
let
firmware = gt68xxFirmware {inherit fetchurl;};
@@ -20,6 +20,7 @@
postInstall = ''
if test "$udevSupport" = "1"; then
ensureDir $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
'';
Index: pkgs/misc/sane-backends/snapshot.nix
===================================================================
--- pkgs/misc/sane-backends/snapshot.nix (revision 0)
+++ pkgs/misc/sane-backends/snapshot.nix (working copy)
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, hotplugSupport ? true, libusb ? null
+, gt68xxFirmware ? null }:
+let
+ firmware = gt68xxFirmware {inherit fetchurl;};
+in
+assert hotplugSupport -> stdenv.system == "i686-linux";
+
+stdenv.mkDerivation rec {
+ name = "sane-backends-1.0.22.git201111204";
+
+ src = fetchurl {
+ url = http://www.sane-project.org/snapshots/sane-backends-git20111204.tar.gz;
+ sha256 = "00b3fi8zjrq3in0wndz1xcz228mgfhwhh2knmyjsikr88hal0m47";
+ };
+
+ udevSupport = hotplugSupport;
+
+ buildInputs = if libusb != null then [libusb] else [];
+
+ postInstall = ''
+ if test "$udevSupport" = "1"; then
+ ensureDir $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 "";
+}
Index: pkgs/top-level/all-packages.nix
===================================================================
--- pkgs/top-level/all-packages.nix (revision 30731)
+++ pkgs/top-level/all-packages.nix (working copy)
@@ -8493,6 +8495,10 @@
gt68xxFirmware = getConfig ["sane" "gt68xxFirmware"] null;
};
+ saneBackendsSnapshot = callPackage ../misc/sane-backends/snapshot.nix {
+ gt68xxFirmware = getConfig ["sane" "gt68xxFirmware"] null;
+ };
+
saneFrontends = callPackage ../misc/sane-front { };
slock = callPackage ../misc/screensavers/slock { };
Index: modules/module-list.nix
===================================================================
--- modules/module-list.nix (revision 30731)
+++ modules/module-list.nix (working copy)
@@ -68,6 +68,7 @@
./services/hardware/bluetooth.nix
./services/hardware/hal.nix
./services/hardware/pcscd.nix
+ ./services/hardware/sane.nix
./services/hardware/udev.nix
./services/hardware/udisks.nix
./services/hardware/upower.nix
Index: modules/services/hardware/sane.nix
===================================================================
--- modules/services/hardware/sane.nix (revision 0)
+++ modules/services/hardware/sane.nix (working copy)
@@ -0,0 +1,34 @@
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+{
+
+ ###### interface
+
+ options = {
+
+ hardware.sane.enable = mkOption {
+ default = false;
+ description = "Enable support for SANE scanners.";
+ };
+
+ hardware.sane.snapshot = mkOption {
+ default = false;
+ description = "Use a development snapshot of SANE scanner drivers.";
+ };
+
+ };
+
+
+ ###### implementation
+
+ config = let pkg = if config.hardware.sane.snapshot
+ then pkgs.saneBackendsSnapshot
+ else pkgs.saneBackends;
+ in mkIf config.hardware.sane.enable {
+ environment.systemPackages = [ pkg ];
+ services.udev.packages = [ pkg ];
+ };
+
+}
--
id' Ash = Ash; id' Dust = Dust; id' _ = undefined
_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev