Author: shlevy
Date: Mon Dec  5 17:32:45 2011
New Revision: 30764
URL: https://nixos.org/websvn/nix/?rev=30764&sc=1

Log:
Apply mornfall's SANE patches

Fix sane-backends to generate udev rules, add a snapshot of sane-backends's 
unstable repo, and add a SANE nixos module

Added:
   nixos/trunk/modules/services/hardware/sane.nix
   nixpkgs/trunk/pkgs/misc/sane-backends/snapshot.nix
      - copied, changed from r30763, 
nixpkgs/trunk/pkgs/misc/sane-backends/default.nix
Modified:
   nixos/trunk/modules/module-list.nix
   nixpkgs/trunk/pkgs/misc/sane-backends/default.nix
   nixpkgs/trunk/pkgs/top-level/all-packages.nix

Modified: nixos/trunk/modules/module-list.nix
==============================================================================
--- nixos/trunk/modules/module-list.nix Mon Dec  5 16:53:58 2011        (r30763)
+++ nixos/trunk/modules/module-list.nix Mon Dec  5 17:32:45 2011        (r30764)
@@ -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

Added: nixos/trunk/modules/services/hardware/sane.nix
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ nixos/trunk/modules/services/hardware/sane.nix      Mon Dec  5 17:32:45 
2011        (r30764)
@@ -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 ];
+      };
+
+}

Modified: nixpkgs/trunk/pkgs/misc/sane-backends/default.nix
==============================================================================
--- nixpkgs/trunk/pkgs/misc/sane-backends/default.nix   Mon Dec  5 16:53:58 
2011        (r30763)
+++ nixpkgs/trunk/pkgs/misc/sane-backends/default.nix   Mon Dec  5 17:32:45 
2011        (r30764)
@@ -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
   '';

Copied and modified: nixpkgs/trunk/pkgs/misc/sane-backends/snapshot.nix (from 
r30763, nixpkgs/trunk/pkgs/misc/sane-backends/default.nix)
==============================================================================
--- nixpkgs/trunk/pkgs/misc/sane-backends/default.nix   Mon Dec  5 16:53:58 
2011        (r30763, copy source)
+++ nixpkgs/trunk/pkgs/misc/sane-backends/snapshot.nix  Mon Dec  5 17:32:45 
2011        (r30764)
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, hotplugSupport ? false, libusb ? null
+{ stdenv, fetchurl, hotplugSupport ? true, libusb ? null
 , gt68xxFirmware ? null }:
 let
   firmware = gt68xxFirmware {inherit fetchurl;};
@@ -6,11 +6,11 @@
 assert hotplugSupport -> stdenv.system == "i686-linux";
 
 stdenv.mkDerivation {
-  name = "sane-backends-1.0.21";
+  name = "sane-backends-1.0.22.git201111204";
   
   src = fetchurl {
-    url = 
ftp://ftp.sane-project.org/pub/sane/sane-backends-1.0.21/sane-backends-1.0.21.tar.gz;
-    sha256 = "12wl4a86hxwlrx46lm5z6lw4id3j8wi82yv3khxcz5sqjai2ykp4";
+    url = 
http://www.sane-project.org/snapshots/sane-backends-git20111204.tar.gz;
+    sha256 = "00b3fi8zjrq3in0wndz1xcz228mgfhwhh2knmyjsikr88hal0m47";
   };
   
   udevSupport = hotplugSupport;
@@ -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
   '';

Modified: nixpkgs/trunk/pkgs/top-level/all-packages.nix
==============================================================================
--- nixpkgs/trunk/pkgs/top-level/all-packages.nix       Mon Dec  5 16:53:58 
2011        (r30763)
+++ nixpkgs/trunk/pkgs/top-level/all-packages.nix       Mon Dec  5 17:32:45 
2011        (r30764)
@@ -8486,6 +8486,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 { };
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to