about summary refs log tree commit diff
path: root/pkgs/os-specific/linux
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/linux')
-rw-r--r--pkgs/os-specific/linux/alsa-plugins/default.nix20
-rw-r--r--pkgs/os-specific/linux/blcr/default.nix35
-rw-r--r--pkgs/os-specific/linux/bluez/default.nix19
-rw-r--r--pkgs/os-specific/linux/broadcom-sta/default.nix4
-rw-r--r--pkgs/os-specific/linux/firmware/radeon-juniper/default.nix31
-rw-r--r--pkgs/os-specific/linux/firmware/radeon-r600/default.nix2
-rw-r--r--pkgs/os-specific/linux/firmware/radeon-r700/default.nix2
-rw-r--r--pkgs/os-specific/linux/firmware/rtl8192c/default.nix23
-rw-r--r--pkgs/os-specific/linux/kernel/aufs2-33.patch82
-rw-r--r--pkgs/os-specific/linux/kernel/aufs2.1-3.0.patch70
-rw-r--r--pkgs/os-specific/linux/kernel/aufs2.1-36.patch81
-rw-r--r--pkgs/os-specific/linux/kernel/aufs2.1-39.patch70
-rw-r--r--pkgs/os-specific/linux/kernel/generic.nix18
-rw-r--r--pkgs/os-specific/linux/kernel/linux-2.6.27.nix6
-rw-r--r--pkgs/os-specific/linux/kernel/linux-2.6.32.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-2.6.33.nix6
-rw-r--r--pkgs/os-specific/linux/kernel/linux-2.6.34.nix6
-rw-r--r--pkgs/os-specific/linux/kernel/linux-2.6.35.nix6
-rw-r--r--pkgs/os-specific/linux/kernel/linux-2.6.36.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-2.6.38.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-2.6.39.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-3.0.nix218
-rw-r--r--pkgs/os-specific/linux/kernel/linux-3.1.nix220
-rw-r--r--pkgs/os-specific/linux/kernel/patches.nix49
-rw-r--r--pkgs/os-specific/linux/libatasmart/default.nix18
-rw-r--r--pkgs/os-specific/linux/libnl/v2.nix1
-rw-r--r--pkgs/os-specific/linux/lvm2/default.nix20
-rw-r--r--pkgs/os-specific/linux/lvm2/purity.patch55
-rw-r--r--pkgs/os-specific/linux/mountall/default.nix8
-rw-r--r--pkgs/os-specific/linux/mountall/no-plymouth.patch76
-rw-r--r--pkgs/os-specific/linux/multipath-tools/default.nix4
-rw-r--r--pkgs/os-specific/linux/nvidia-x11/default.nix6
-rw-r--r--pkgs/os-specific/linux/pm-utils/default.nix23
-rw-r--r--pkgs/os-specific/linux/qemu-kvm/default.nix12
-rw-r--r--pkgs/os-specific/linux/rtkit/default.nix18
-rw-r--r--pkgs/os-specific/linux/udev/173.nix (renamed from pkgs/os-specific/linux/udev/166.nix)24
-rw-r--r--pkgs/os-specific/linux/udev/custom-rules.patch91
-rw-r--r--pkgs/os-specific/linux/udisks/default.nix46
-rw-r--r--pkgs/os-specific/linux/udisks/purity.patch74
-rw-r--r--pkgs/os-specific/linux/upower/default.nix34
-rw-r--r--pkgs/os-specific/linux/v4l-utils/default.nix50
-rw-r--r--pkgs/os-specific/linux/xf86-input-multitouch/default.nix53
-rw-r--r--pkgs/os-specific/linux/xf86-input-wacom/10-wacom.rules16
-rw-r--r--pkgs/os-specific/linux/xf86-input-wacom/default.nix23
44 files changed, 1457 insertions, 179 deletions
diff --git a/pkgs/os-specific/linux/alsa-plugins/default.nix b/pkgs/os-specific/linux/alsa-plugins/default.nix
index dc36757e020e1..2ae39d4cf16d9 100644
--- a/pkgs/os-specific/linux/alsa-plugins/default.nix
+++ b/pkgs/os-specific/linux/alsa-plugins/default.nix
@@ -1,21 +1,21 @@
-{stdenv, fetchurl, lib, pkgconfig, alsaLib, pulseaudio, jackaudio}:
-stdenv.mkDerivation {
+{ stdenv, fetchurl, lib, pkgconfig, alsaLib, pulseaudio ? null, jackaudio ? null }:
+
+stdenv.mkDerivation rec {
   name = "alsa-plugins-1.0.23";
 
   src = fetchurl {
-    url = ftp://ftp.alsa-project.org/pub/plugins/alsa-plugins-1.0.23.tar.bz2;
+    url = "ftp://ftp.alsa-project.org/pub/plugins/${name}.tar.bz2";
     sha256 = "10ri5dpmhk028r0qvajswh2xl40kjd600h7hykq03vrkmn8jf6sw";
   };
 
-  # TODO make backends such as jack, pulseaudio optional
-  buildInputs = [pkgconfig alsaLib pulseaudio jackaudio];
+  buildInputs =
+    [ pkgconfig alsaLib ]
+    ++ stdenv.lib.optional (pulseaudio != null) pulseaudio
+    ++ stdenv.lib.optional (jackaudio != null) jackaudio;
 
   meta = { 
-    description = "plugins for alsa eg conneckt jack, pluseaudio applications easily to the daemons using alsa devices";
-    longDescription = "
-      use it like this: export ALSA_PLUGIN_DIRS=$(nix-build -A alsaPlugins)/lib/alsa-lib
-    ";
-    homepage = http://alsa-project.org;
+    description = "Various plugins for ALSA";
+    homepage = http://alsa-project.org/;
     license = "GPL2.1";
     maintainers = [lib.maintainers.marcweber];
     platforms = lib.platforms.linux;
diff --git a/pkgs/os-specific/linux/blcr/default.nix b/pkgs/os-specific/linux/blcr/default.nix
index 01ab430b1ff7f..afe627f788660 100644
--- a/pkgs/os-specific/linux/blcr/default.nix
+++ b/pkgs/os-specific/linux/blcr/default.nix
@@ -1,42 +1,21 @@
-{ stdenv, fetchurl, kernel, perl, makeWrapper, autoconf, automake, libtool }:
+{ stdenv, fetchurl, kernel, perl, makeWrapper }:
 
 assert stdenv.isLinux;
 
-let
-  version = "0.8.2";
-  #website = https://ftg.lbl.gov/CheckpointRestart;
-in
-
 stdenv.mkDerivation {
-  name = "blcr-${version}-${kernel.version}";
+  name = "blcr-0.8.3-${kernel.version}";
 
   src = fetchurl {
-    url = https://ftg.lbl.gov/assets/projects/CheckpointRestart/downloads/blcr-0.8.2.tar.gz;
-    #url = "${website}/downloads/blcr-${version}.tar.gz";
-    sha256 = "1ldvzrajljkm318z5ix1p27n0gmv7gqxij6ck7p5fz4ncdbb01x8";
+    url = https://ftg.lbl.gov/assets/projects/CheckpointRestart/downloads/blcr-0.8.3.tar.gz;
+    sha256 = "c8243c9a7a215d4fc4e8f2199045711cf711a6f2e0b39a94413478ffae110eac";
   };
-  
-  patchFlags = "-p0";
-
-  patches = map fetchurl [
-    { url = http://upc-bugs.lbl.gov/blcr-dist/blcr-0.8.2+kernel-2.6.31.patch01;
-      sha256 = "0jnz18kbrm64hahvhk35zakcpylad1khsp5kjxkj19j0lkjv3m4h";
-    }
-    { url = http://upc-bugs.lbl.gov/blcr-dist/blcr-0.8.2+kernel-2.6.32.patch02;
-      sha256 = "1f5s9c7iiaxd67ki3bmz09mf66shzbl97hvwaq4nmk6miq94k1fw";
-    }
-    { url = http://upc-bugs.lbl.gov/blcr-dist/blcr-0.8.2+kernel-2.6.34.patch03;
-      sha256 = "0g2v67n40ikx5hja7zgnc2axif16r2sibi5vf0r4wjzc5z9gdfrh";
-    }
-  ];
 
-  buildInputs = [ perl makeWrapper autoconf automake libtool ];
+  buildInputs = [ perl makeWrapper ];
 
   preConfigure = ''
-    ./autogen.sh
     configureFlagsArray=(
-      --with-linux=$(ls -d ${kernel}/lib/modules/*/build)
-      --with-kmod-dir=$out/lib/modules/$(cd ${kernel}/lib/modules; ls -d 2.6.*)
+      --with-linux=${kernel}/lib/modules/${kernel.modDirVersion}/build
+      --with-kmod-dir=$out/lib/modules/${kernel.modDirVersion}
       --with-system-map=${kernel}/System.map
     )
   '';
diff --git a/pkgs/os-specific/linux/bluez/default.nix b/pkgs/os-specific/linux/bluez/default.nix
index be21c759e5037..c0aec5a7b5698 100644
--- a/pkgs/os-specific/linux/bluez/default.nix
+++ b/pkgs/os-specific/linux/bluez/default.nix
@@ -9,21 +9,30 @@ let
 in
    
 stdenv.mkDerivation rec {
-  name = "bluez-4.90";
+  name = "bluez-4.95";
    
   src = fetchurl {
     url = "mirror://kernel/linux/bluetooth/${name}.tar.gz";
-    sha256 = "18wq75m45q00fvddzgfqy1d4368649r2jl3j4yvpijymalc4jra7";
+    sha256 = "1xi087x2ggdywq63qp55wvi1iclk50hc42fp40kcsazw23j9vsnn";
   };
 
-  buildInputs = [ pkgconfig dbus.libs glib libusb alsaLib python makeWrapper
-    gst_all.gstreamer gst_all.gstPluginsBase readline libsndfile ];
+  buildInputs =
+    [ pkgconfig dbus.libs glib libusb alsaLib python makeWrapper
+      readline libsndfile
+      # Disables GStreamer; not clear what it gains us other than a
+      # zillion extra dependencies.
+      # gst_all.gstreamer gst_all.gstPluginsBase 
+    ];
 
-  configureFlags = "--localstatedir=/var --enable-udevrules --enable-configrules --enable-cups";
+  configureFlags = "--localstatedir=/var --enable-cups";
 
   # Work around `make install' trying to create /var/lib/bluetooth.
   installFlags = "statedir=$(TMPDIR)/var/lib/bluetooth";
 
+  makeFlags = "rulesdir=$(out)/lib/udev/rules.d";
+
+  /* !!! Move these into a separate package to prevent Bluez from
+    depending on Python etc. */
   postInstall = ''
     pushd test
     for a in simple-agent test-adapter test-device; do
diff --git a/pkgs/os-specific/linux/broadcom-sta/default.nix b/pkgs/os-specific/linux/broadcom-sta/default.nix
index d2c2b5f13077e..9749b1568e460 100644
--- a/pkgs/os-specific/linux/broadcom-sta/default.nix
+++ b/pkgs/os-specific/linux/broadcom-sta/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
     (! builtins.lessThan (builtins.compareVersions kernel.version "2.6.37") 0)
       [ ./mutex-sema.patch ];
 
-  makeFlags = "KDIR=${kernel}/lib/modules/${kernel.version}/build";
+  makeFlags = "KDIR=${kernel}/lib/modules/${kernel.modDirVersion}/build";
 
   unpackPhase =
     ''
@@ -31,7 +31,7 @@ stdenv.mkDerivation {
 
   installPhase =
     ''
-      binDir="$out/lib/modules/${kernel.version}/kernel/net/wireless/"
+      binDir="$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
       docDir="$out/share/doc/broadcom-sta/"
       ensureDir "$binDir" "$docDir"
       cp wl.ko "$binDir"
diff --git a/pkgs/os-specific/linux/firmware/radeon-juniper/default.nix b/pkgs/os-specific/linux/firmware/radeon-juniper/default.nix
new file mode 100644
index 0000000000000..ad277ac8ddaea
--- /dev/null
+++ b/pkgs/os-specific/linux/firmware/radeon-juniper/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "radeon-juniper-firmware-2010-04-08";
+
+  srcPfp = fetchurl {
+    url = "http://people.freedesktop.org/~agd5f/radeon_ucode/JUNIPER_pfp.bin";
+    sha256 = "1qm910p7qjs6n528q22gkwpprzdh39vbihdliykbpfs1pphrhkjz";
+  };
+  srcMe = fetchurl {
+    url = "http://people.freedesktop.org/~agd5f/radeon_ucode/JUNIPER_me.bin";
+    sha256 = "1869dhay3f75hhnsvdjhlrjd4fhdi8d6c3lhk45vp7fhjiw4741q";
+  };
+  srcRlc = fetchurl {
+    url = "http://people.freedesktop.org/~agd5f/radeon_ucode/JUNIPER_rlc.bin";
+    sha256 = "1y3xr7qc7cvszgw0bh66vzy36pn4m1sj17bzy5dc9kfw01kq3n0y";
+  };
+
+  unpackPhase = "true";
+  installPhase = ''
+    install -D $srcPfp $out/radeon/JUNIPER_pfp.bin
+    install -D $srcMe $out/radeon/JUNIPER_me.bin
+    install -D $srcRlc $out/radeon/JUNIPER_rlc.bin
+  '';
+
+  meta = {
+    description = "Juniper firmware for the RADEON chipset";
+    homepage = "http://people.freedesktop.org/~agd5f/radeon_ucode";
+    license = "GPL";
+  };
+}
diff --git a/pkgs/os-specific/linux/firmware/radeon-r600/default.nix b/pkgs/os-specific/linux/firmware/radeon-r600/default.nix
index ed44b2eed78c3..9a298ab96d4af 100644
--- a/pkgs/os-specific/linux/firmware/radeon-r600/default.nix
+++ b/pkgs/os-specific/linux/firmware/radeon-r600/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation {
   name = "radeon-r600-firmware-2009-12-09";
 
   src = fetchurl {
diff --git a/pkgs/os-specific/linux/firmware/radeon-r700/default.nix b/pkgs/os-specific/linux/firmware/radeon-r700/default.nix
index 92e9597379907..09342f687e95b 100644
--- a/pkgs/os-specific/linux/firmware/radeon-r700/default.nix
+++ b/pkgs/os-specific/linux/firmware/radeon-r700/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation {
   name = "radeon-r700-firmware-2009-12-09";
 
   src = fetchurl {
diff --git a/pkgs/os-specific/linux/firmware/rtl8192c/default.nix b/pkgs/os-specific/linux/firmware/rtl8192c/default.nix
new file mode 100644
index 0000000000000..0ab7436ebfff3
--- /dev/null
+++ b/pkgs/os-specific/linux/firmware/rtl8192c/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  name = "rtl8192c-fw";
+  src = fetchurl {
+    url = "ftp://WebUser:n8W9ErCy@208.70.202.219/cn/wlan/92ce_se_de_linux_mac80211_0003.0401.2011.tar.gz";
+    sha256 = "002kj6f1xaali2iwrxvirqq0hbiyb2cpf93y2xycp3qd69cp8lik";
+  };
+
+  phases = [ "unpackPhase" "installPhase" ];
+
+  # Installation copies the firmware AND the license.  The license
+  # says: "Your rights to redistribute the Software shall be
+  # contingent upon your installation of this Agreement in its
+  # entirety in the same directory as the Software."
+  installPhase = "ensureDir $out; cp -a firmware/* $out";
+  
+  meta = {
+    description = "Firmware for the Realtek RTL8192c wireless cards";
+    homepage = "http://www.realtek.com";
+    license = "non-free";
+  };
+}
diff --git a/pkgs/os-specific/linux/kernel/aufs2-33.patch b/pkgs/os-specific/linux/kernel/aufs2-33.patch
new file mode 100644
index 0000000000000..49a660b0c9e86
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/aufs2-33.patch
@@ -0,0 +1,82 @@
+ufs2 base patch for linux-2.6.33
+
+diff --git a/fs/namei.c b/fs/namei.c
+index a4855af..1d12d37 100644
+--- a/fs/namei.c
++++ b/fs/namei.c
+@@ -1207,7 +1207,7 @@ out:
+  * needs parent already locked. Doesn't follow mounts.
+  * SMP-safe.
+  */
+-static struct dentry *lookup_hash(struct nameidata *nd)
++struct dentry *lookup_hash(struct nameidata *nd)
+ {
+        int err;
+ 
+@@ -1217,7 +1217,7 @@ static struct dentry *lookup_hash(struct nameidata *nd)
+        return __lookup_hash(&nd->last, nd->path.dentry, nd);
+ }
+ 
+-static int __lookup_one_len(const char *name, struct qstr *this,
++int __lookup_one_len(const char *name, struct qstr *this,
+                struct dentry *base, int len)
+ {
+        unsigned long hash;
+diff --git a/fs/splice.c b/fs/splice.c
+index 3920866..b13a9a2 100644
+--- a/fs/splice.c
++++ b/fs/splice.c
+@@ -1053,8 +1053,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
+ /*
+  * Attempt to initiate a splice from pipe to file.
+  */
+-static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+-                          loff_t *ppos, size_t len, unsigned int flags)
++long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
++                   loff_t *ppos, size_t len, unsigned int flags)
+ {
+        ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
+                                loff_t *, size_t, unsigned int);
+@@ -1081,9 +1081,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+ /*
+  * Attempt to initiate a splice from a file to a pipe.
+  */
+-static long do_splice_to(struct file *in, loff_t *ppos,
+-                        struct pipe_inode_info *pipe, size_t len,
+-                        unsigned int flags)
++long do_splice_to(struct file *in, loff_t *ppos,
++                 struct pipe_inode_info *pipe, size_t len,
++                 unsigned int flags)
+ {
+        ssize_t (*splice_read)(struct file *, loff_t *,
+                               struct pipe_inode_info *, size_t, unsigned int);
+diff --git a/include/linux/namei.h b/include/linux/namei.h
+index 05b441d..91bc74e 100644
+--- a/include/linux/namei.h
++++ b/include/linux/namei.h
+@@ -73,6 +73,9 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
+ extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
+                int (*open)(struct inode *, struct file *));
+ 
++extern struct dentry *lookup_hash(struct nameidata *nd);
++extern int __lookup_one_len(const char *name, struct qstr *this,
++                           struct dentry *base, int len);
+ extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
+ 
+ extern int follow_down(struct path *);
+diff --git a/include/linux/splice.h b/include/linux/splice.h
+index 18e7c7c..8393b5c 100644
+--- a/include/linux/splice.h
++++ b/include/linux/splice.h
+@@ -82,4 +82,10 @@ extern ssize_t splice_to_pipe(struct pipe_inode_info *,
+ extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
+                                      splice_direct_actor *);
+ 
++extern long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
++                          loff_t *ppos, size_t len, unsigned int flags);
++extern long do_splice_to(struct file *in, loff_t *ppos,
++                        struct pipe_inode_info *pipe, size_t len,
++                        unsigned int flags);
++
+ #endif
+
diff --git a/pkgs/os-specific/linux/kernel/aufs2.1-3.0.patch b/pkgs/os-specific/linux/kernel/aufs2.1-3.0.patch
new file mode 100644
index 0000000000000..000c6b995c71c
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/aufs2.1-3.0.patch
@@ -0,0 +1,70 @@
+aufs2.1 base patch for linux-3.0
+
+diff --git a/fs/namei.c b/fs/namei.c
+index 14ab8d3..eb4aef1 100644
+--- a/fs/namei.c
++++ b/fs/namei.c
+@@ -1697,7 +1697,7 @@ static struct dentry *__lookup_hash(struct qstr *name,
+  * needs parent already locked. Doesn't follow mounts.
+  * SMP-safe.
+  */
+-static struct dentry *lookup_hash(struct nameidata *nd)
++struct dentry *lookup_hash(struct nameidata *nd)
+ {
+ 	return __lookup_hash(&nd->last, nd->path.dentry, nd);
+ }
+diff --git a/fs/splice.c b/fs/splice.c
+index aa866d3..19afec6 100644
+--- a/fs/splice.c
++++ b/fs/splice.c
+@@ -1085,8 +1085,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
+ /*
+  * Attempt to initiate a splice from pipe to file.
+  */
+-static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+-			   loff_t *ppos, size_t len, unsigned int flags)
++long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
++		    loff_t *ppos, size_t len, unsigned int flags)
+ {
+ 	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
+ 				loff_t *, size_t, unsigned int);
+@@ -1113,9 +1113,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+ /*
+  * Attempt to initiate a splice from a file to a pipe.
+  */
+-static long do_splice_to(struct file *in, loff_t *ppos,
+-			 struct pipe_inode_info *pipe, size_t len,
+-			 unsigned int flags)
++long do_splice_to(struct file *in, loff_t *ppos,
++		  struct pipe_inode_info *pipe, size_t len,
++		  unsigned int flags)
+ {
+ 	ssize_t (*splice_read)(struct file *, loff_t *,
+ 			       struct pipe_inode_info *, size_t, unsigned int);
+diff --git a/include/linux/namei.h b/include/linux/namei.h
+index eba45ea..21ed6c9 100644
+--- a/include/linux/namei.h
++++ b/include/linux/namei.h
+@@ -82,6 +82,7 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
+ extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
+ 		int (*open)(struct inode *, struct file *));
+ 
++extern struct dentry *lookup_hash(struct nameidata *nd);
+ extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
+ 
+ extern int follow_down_one(struct path *);
+diff --git a/include/linux/splice.h b/include/linux/splice.h
+index 997c3b4..be9a153 100644
+--- a/include/linux/splice.h
++++ b/include/linux/splice.h
+@@ -89,4 +89,10 @@ extern int splice_grow_spd(struct pipe_inode_info *, struct splice_pipe_desc *);
+ extern void splice_shrink_spd(struct pipe_inode_info *,
+ 				struct splice_pipe_desc *);
+ 
++extern long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
++			   loff_t *ppos, size_t len, unsigned int flags);
++extern long do_splice_to(struct file *in, loff_t *ppos,
++			 struct pipe_inode_info *pipe, size_t len,
++			 unsigned int flags);
++
+ #endif
diff --git a/pkgs/os-specific/linux/kernel/aufs2.1-36.patch b/pkgs/os-specific/linux/kernel/aufs2.1-36.patch
new file mode 100644
index 0000000000000..9003e67620c6d
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/aufs2.1-36.patch
@@ -0,0 +1,81 @@
+aufs2.1 base patch for linux-2.6.36
+
+diff --git a/fs/namei.c b/fs/namei.c
+index 24896e8..19d69c5 100644
+--- a/fs/namei.c
++++ b/fs/namei.c
+@@ -1159,7 +1159,7 @@ out:
+  * needs parent already locked. Doesn't follow mounts.
+  * SMP-safe.
+  */
+-static struct dentry *lookup_hash(struct nameidata *nd)
++struct dentry *lookup_hash(struct nameidata *nd)
+ {
+ 	int err;
+ 
+@@ -1169,7 +1169,7 @@ static struct dentry *lookup_hash(struct nameidata *nd)
+ 	return __lookup_hash(&nd->last, nd->path.dentry, nd);
+ }
+ 
+-static int __lookup_one_len(const char *name, struct qstr *this,
++int __lookup_one_len(const char *name, struct qstr *this,
+ 		struct dentry *base, int len)
+ {
+ 	unsigned long hash;
+diff --git a/fs/splice.c b/fs/splice.c
+index 8f1dfae..278c94f 100644
+--- a/fs/splice.c
++++ b/fs/splice.c
+@@ -1092,8 +1092,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
+ /*
+  * Attempt to initiate a splice from pipe to file.
+  */
+-static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+-			   loff_t *ppos, size_t len, unsigned int flags)
++long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
++		    loff_t *ppos, size_t len, unsigned int flags)
+ {
+ 	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
+ 				loff_t *, size_t, unsigned int);
+@@ -1120,9 +1120,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+ /*
+  * Attempt to initiate a splice from a file to a pipe.
+  */
+-static long do_splice_to(struct file *in, loff_t *ppos,
+-			 struct pipe_inode_info *pipe, size_t len,
+-			 unsigned int flags)
++long do_splice_to(struct file *in, loff_t *ppos,
++		  struct pipe_inode_info *pipe, size_t len,
++		  unsigned int flags)
+ {
+ 	ssize_t (*splice_read)(struct file *, loff_t *,
+ 			       struct pipe_inode_info *, size_t, unsigned int);
+diff --git a/include/linux/namei.h b/include/linux/namei.h
+index 05b441d..91bc74e 100644
+--- a/include/linux/namei.h
++++ b/include/linux/namei.h
+@@ -73,6 +73,9 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
+ extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
+ 		int (*open)(struct inode *, struct file *));
+ 
++extern struct dentry *lookup_hash(struct nameidata *nd);
++extern int __lookup_one_len(const char *name, struct qstr *this,
++			    struct dentry *base, int len);
+ extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
+ 
+ extern int follow_down(struct path *);
+diff --git a/include/linux/splice.h b/include/linux/splice.h
+index 997c3b4..be9a153 100644
+--- a/include/linux/splice.h
++++ b/include/linux/splice.h
+@@ -89,4 +89,10 @@ extern int splice_grow_spd(struct pipe_inode_info *, struct splice_pipe_desc *);
+ extern void splice_shrink_spd(struct pipe_inode_info *,
+ 				struct splice_pipe_desc *);
+ 
++extern long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
++			   loff_t *ppos, size_t len, unsigned int flags);
++extern long do_splice_to(struct file *in, loff_t *ppos,
++			 struct pipe_inode_info *pipe, size_t len,
++			 unsigned int flags);
++
+ #endif
diff --git a/pkgs/os-specific/linux/kernel/aufs2.1-39.patch b/pkgs/os-specific/linux/kernel/aufs2.1-39.patch
new file mode 100644
index 0000000000000..e98dc85a214f3
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/aufs2.1-39.patch
@@ -0,0 +1,70 @@
+aufs2.1 base patch for linux-2.6.39
+
+diff --git a/fs/namei.c b/fs/namei.c
+index e3c4f11..202d358 100644
+--- a/fs/namei.c
++++ b/fs/namei.c
+@@ -1769,7 +1769,7 @@ static struct dentry *__lookup_hash(struct qstr *name,
+  * needs parent already locked. Doesn't follow mounts.
+  * SMP-safe.
+  */
+-static struct dentry *lookup_hash(struct nameidata *nd)
++struct dentry *lookup_hash(struct nameidata *nd)
+ {
+ 	return __lookup_hash(&nd->last, nd->path.dentry, nd);
+ }
+diff --git a/fs/splice.c b/fs/splice.c
+index 50a5d978..886e942 100644
+--- a/fs/splice.c
++++ b/fs/splice.c
+@@ -1081,8 +1081,8 @@ EXPORT_SYMBOL(generic_splice_sendpage);
+ /*
+  * Attempt to initiate a splice from pipe to file.
+  */
+-static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+-			   loff_t *ppos, size_t len, unsigned int flags)
++long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
++		    loff_t *ppos, size_t len, unsigned int flags)
+ {
+ 	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
+ 				loff_t *, size_t, unsigned int);
+@@ -1109,9 +1109,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
+ /*
+  * Attempt to initiate a splice from a file to a pipe.
+  */
+-static long do_splice_to(struct file *in, loff_t *ppos,
+-			 struct pipe_inode_info *pipe, size_t len,
+-			 unsigned int flags)
++long do_splice_to(struct file *in, loff_t *ppos,
++		  struct pipe_inode_info *pipe, size_t len,
++		  unsigned int flags)
+ {
+ 	ssize_t (*splice_read)(struct file *, loff_t *,
+ 			       struct pipe_inode_info *, size_t, unsigned int);
+diff --git a/include/linux/namei.h b/include/linux/namei.h
+index eba45ea..21ed6c9 100644
+--- a/include/linux/namei.h
++++ b/include/linux/namei.h
+@@ -82,6 +82,7 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
+ extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
+ 		int (*open)(struct inode *, struct file *));
+ 
++extern struct dentry *lookup_hash(struct nameidata *nd);
+ extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
+ 
+ extern int follow_down_one(struct path *);
+diff --git a/include/linux/splice.h b/include/linux/splice.h
+index 997c3b4..be9a153 100644
+--- a/include/linux/splice.h
++++ b/include/linux/splice.h
+@@ -89,4 +89,10 @@ extern int splice_grow_spd(struct pipe_inode_info *, struct splice_pipe_desc *);
+ extern void splice_shrink_spd(struct pipe_inode_info *,
+ 				struct splice_pipe_desc *);
+ 
++extern long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
++			   loff_t *ppos, size_t len, unsigned int flags);
++extern long do_splice_to(struct file *in, loff_t *ppos,
++			 struct pipe_inode_info *pipe, size_t len,
++			 unsigned int flags);
++
+ #endif
diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix
index ce609f2384993..a86aef1af8e3c 100644
--- a/pkgs/os-specific/linux/kernel/generic.nix
+++ b/pkgs/os-specific/linux/kernel/generic.nix
@@ -6,6 +6,9 @@
 , # The kernel version.
   version
 
+, # The version number used for the module directory
+  modDirVersion ? version
+
 , # The kernel configuration.
   config
 
@@ -35,6 +38,7 @@
 , extraMeta ? {}
 , ubootChooser ? null
 , postInstall ? ""
+, setModuleDir ? true
 
 , # After the builder did a 'make all' (kernel + modules)
   # we force building the target asked: bzImage/zImage/uImage/...
@@ -65,7 +69,7 @@ stdenv.mkDerivation {
   enableParallelBuilding = true;
 
   passthru = {
-    inherit version;
+    inherit version modDirVersion;
     # Combine the `features' attribute sets of all the kernel patches.
     features = lib.fold (x: y: (if x ? features then x.features else {}) // y) features kernelPatches;
   };
@@ -74,7 +78,16 @@ stdenv.mkDerivation {
 
   generateConfig = ./generate-config.pl;
 
-  inherit preConfigure src module_init_tools localVersion postBuild postInstall;
+  inherit preConfigure src module_init_tools localVersion postInstall;
+
+  #Currently, the builder sets $MODULE_DIR during installPhase. This causes
+  #problems with at least linux 3.0, so we need to conditionally avoid
+  #setting $MODULE_DIR. This prepend to postBuild accomplishes this with a
+  #sed/eval trick thanks to MarcWeber
+
+  postBuild = (if setModuleDir then "" else '' 
+    eval "$(type installPhase | sed -e '1d' -e '/export MODULE_DIR/d')";
+  '') + postBuild;
 
   patches = map (p: p.patch) kernelPatches;
 
@@ -140,3 +153,4 @@ stdenv.mkDerivation {
     platforms = lib.platforms.linux;
   } // extraMeta;
 }
+
diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.27.nix b/pkgs/os-specific/linux/kernel/linux-2.6.27.nix
index 80aada9e7da4d..083948fd345be 100644
--- a/pkgs/os-specific/linux/kernel/linux-2.6.27.nix
+++ b/pkgs/os-specific/linux/kernel/linux-2.6.27.nix
@@ -3,11 +3,11 @@ args @ { stdenv, fetchurl, userModeLinux ? false, extraConfig ? "", ... }:
 import ./generic.nix (
 
   rec {
-    version = "2.6.27.57";
+    version = "2.6.27.59";
   
     src = fetchurl {
-      url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
-      sha256 = "15irwzzhccnrbc422h1z0p3dgs9qmk3r77w2c8via7rc4vwxsvp0";
+      url = "mirror://kernel/linux/kernel/v2.6/longterm/v2.6.27/linux-${version}.tar.bz2";
+      sha256 = "0gvp9djj3s8h1375xdjv6ycd0mgmcbvfmswxkpwxdlplly5hr1kf";
     };
 
     features.iwlwifi = true;
diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.32.nix b/pkgs/os-specific/linux/kernel/linux-2.6.32.nix
index dfbdc534e11b5..1c2e1fb5e30c8 100644
--- a/pkgs/os-specific/linux/kernel/linux-2.6.32.nix
+++ b/pkgs/os-specific/linux/kernel/linux-2.6.32.nix
@@ -198,11 +198,11 @@ in
 import ./generic.nix (
 
   rec {
-    version = "2.6.32.41";
+    version = "2.6.32.45";
   
     src = fetchurl {
       url = "mirror://kernel/linux/kernel/v2.6/longterm/v2.6.32/linux-${version}.tar.bz2";
-      sha256 = "0s1ck6q1zv1jy7zgbm89f2lk1m991wrp2fp7cffrinnzmx8j96lk";
+      sha256 = "1lyp0zl8hk2nz93n803iwfkg5g2dcd18hg0ifszg2rik8svvbbrs";
     };
 
     config = configWithPlatform stdenv.platform;
diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.33.nix b/pkgs/os-specific/linux/kernel/linux-2.6.33.nix
index cab697dc1d78f..e473faa16a80d 100644
--- a/pkgs/os-specific/linux/kernel/linux-2.6.33.nix
+++ b/pkgs/os-specific/linux/kernel/linux-2.6.33.nix
@@ -197,11 +197,11 @@ in
 import ./generic.nix (
 
   rec {
-    version = "2.6.33.7";
+    version = "2.6.33.17";
   
     src = fetchurl {
-      url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
-      sha256 = "006shp6fkyzah02a33g1ch1x1svdlkl3kfp2b191c2vrrn6hgyim";
+      url = "mirror://kernel/linux/kernel/v2.6/longterm/v2.6.33/linux-${version}.tar.bz2";
+      sha256 = "06z6r2jip781bxvrfc12gkckzig9s65pnhb3cg2c7c637phc6ky0";
     };
 
     config = configWithPlatform stdenv.platform;
diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.34.nix b/pkgs/os-specific/linux/kernel/linux-2.6.34.nix
index a055487239625..d36a76864833c 100644
--- a/pkgs/os-specific/linux/kernel/linux-2.6.34.nix
+++ b/pkgs/os-specific/linux/kernel/linux-2.6.34.nix
@@ -194,11 +194,11 @@ in
 import ./generic.nix (
 
   rec {
-    version = "2.6.34.7";
+    version = "2.6.34.10";
   
     src = fetchurl {
-      url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
-      sha256 = "0jyw7pl46iffv81qgrjf1cn492mks994klly8fvadc13c6jsb77h";
+      url = "mirror://kernel/linux/kernel/v2.6/longterm/v2.6.34/linux-${version}.tar.bz2";
+      sha256 = "1sm3n5wxz1amql0ini5mspiaa4kvw9macsp5qyq1dhhfv06i2j31";
     };
 
     config = configWithPlatform stdenv.platform;
diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.35.nix b/pkgs/os-specific/linux/kernel/linux-2.6.35.nix
index 0b0db0875ede6..d94c5f382a576 100644
--- a/pkgs/os-specific/linux/kernel/linux-2.6.35.nix
+++ b/pkgs/os-specific/linux/kernel/linux-2.6.35.nix
@@ -190,11 +190,11 @@ in
 import ./generic.nix (
 
   rec {
-    version = "2.6.35.9";
+    version = "2.6.35.14";
   
     src = fetchurl {
-      url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
-      sha256 = "01mzbbi013k3fbfgnphq9j3a5j7k33vdq303yaxwfy1h2qd6gggn";
+      url = "mirror://kernel/linux/kernel/v2.6/longterm/v2.6.35/linux-${version}.tar.bz2";
+      sha256 = "1wzml7s9karfbk2yi36g1r8fyaq4d4f16yizc68zgchv0xzj39zl";
     };
 
     config = configWithPlatform stdenv.platform;
diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.36.nix b/pkgs/os-specific/linux/kernel/linux-2.6.36.nix
index 82c008802a052..4fa11413cabe8 100644
--- a/pkgs/os-specific/linux/kernel/linux-2.6.36.nix
+++ b/pkgs/os-specific/linux/kernel/linux-2.6.36.nix
@@ -192,11 +192,11 @@ in
 import ./generic.nix (
 
   rec {
-    version = "2.6.36.3";
+    version = "2.6.36.4";
   
     src = fetchurl {
       url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
-      sha256 = "1kxj4m9f5iplbll1c5inszg5yxywakz533nl5p4ia84mq2ch03dc";
+      sha256 = "16pqjz3dgvaghfi0jqp2d0nqyz5fgbbxzs914vxslh2xxdxql0cg";
     };
 
     config = configWithPlatform stdenv.platform;
diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.38.nix b/pkgs/os-specific/linux/kernel/linux-2.6.38.nix
index a17fc8d7c7623..c9f2fc9068482 100644
--- a/pkgs/os-specific/linux/kernel/linux-2.6.38.nix
+++ b/pkgs/os-specific/linux/kernel/linux-2.6.38.nix
@@ -191,11 +191,11 @@ in
 import ./generic.nix (
 
   rec {
-    version = "2.6.38.4";
+    version = "2.6.38.8";
   
     src = fetchurl {
       url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
-      sha256 = "0v64kf4qh0smgag5sldl2q6wif84vglj84w9bc6xc282k1n1zmns";
+      sha256 = "16zrwb2wjsg02l4sbbm7aipq9f9v267ys4n6hmaixa6v5rrf7gbi";
     };
 
     config = configWithPlatform stdenv.platform;
diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.39.nix b/pkgs/os-specific/linux/kernel/linux-2.6.39.nix
index 10f8dbfe85995..44a82e0836d16 100644
--- a/pkgs/os-specific/linux/kernel/linux-2.6.39.nix
+++ b/pkgs/os-specific/linux/kernel/linux-2.6.39.nix
@@ -192,11 +192,11 @@ in
 import ./generic.nix (
 
   rec {
-    version = "2.6.39";
+    version = "2.6.39.4";
   
     src = fetchurl {
       url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
-      sha256 = "1xk1bka63i2hhn5rfaa5pbyqqlwycc3nkwvz3m8aj67flgr1fkaq";
+      sha256 = "10qijh322zbcnsjq21rj228fwksx1ij23gal8zw67gxlvgp48vnj";
     };
 
     config = configWithPlatform stdenv.platform;
diff --git a/pkgs/os-specific/linux/kernel/linux-3.0.nix b/pkgs/os-specific/linux/kernel/linux-3.0.nix
new file mode 100644
index 0000000000000..3d01e83858ff9
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/linux-3.0.nix
@@ -0,0 +1,218 @@
+args @ { stdenv, fetchurl, userModeLinux ? false, extraConfig ? ""
+, perl, mktemp, module_init_tools
+, ... }:
+
+let
+  configWithPlatform = kernelPlatform :
+    ''
+      # Don't include any debug features.
+      DEBUG_KERNEL n
+
+      # Support drivers that need external firmware.
+      STANDALONE n
+
+      # Make /proc/config.gz available.
+      IKCONFIG_PROC y
+
+      # Optimize with -O2, not -Os.
+      CC_OPTIMIZE_FOR_SIZE n
+
+      # Enable the kernel's built-in memory tester.
+      MEMTEST y
+
+      # Disable some expensive (?) features.
+      FTRACE n
+      KPROBES n
+      NUMA? n
+      PM_TRACE_RTC n
+
+      # Enable various subsystems.
+      ACCESSIBILITY y # Accessibility support
+      AUXDISPLAY y # Auxiliary Display support
+      DONGLE y # Serial dongle support
+      HIPPI y
+      MTD_COMPLEX_MAPPINGS y # needed for many devices
+      NET_POCKET y # enable pocket and portable adapters
+      SCSI_LOWLEVEL y # enable lots of SCSI devices
+      SCSI_LOWLEVEL_PCMCIA y
+      SPI y # needed for many devices
+      SPI_MASTER y
+      WAN y
+
+      # Networking options.
+      IP_PNP n
+      IPV6_PRIVACY y
+      NETFILTER_ADVANCED y
+      IP_VS_PROTO_TCP y
+      IP_VS_PROTO_UDP y
+      IP_VS_PROTO_ESP y
+      IP_VS_PROTO_AH y
+      IP_DCCP_CCID3 n # experimental
+      CLS_U32_PERF y
+      CLS_U32_MARK y
+
+      # Wireless networking.
+      IPW2100_MONITOR y # support promiscuous mode
+      IPW2200_MONITOR y # support promiscuous mode
+      HOSTAP_FIRMWARE y # Support downloading firmware images with Host AP driver
+      HOSTAP_FIRMWARE_NVRAM y
+      ATH9K_PCI y # Detect Atheros AR9xxx cards on PCI(e) bus
+      ATH9K_AHB y # Ditto, AHB bus
+
+      # Some settings to make sure that fbcondecor works - in particular,
+      # disable tileblitting and the drivers that need it.
+
+      # Enable various FB devices.
+      FB y
+      FB_EFI y
+      FB_NVIDIA_I2C y # Enable DDC Support
+      FB_RIVA_I2C y
+      FB_ATY_CT y # Mach64 CT/VT/GT/LT (incl. 3D RAGE) support
+      FB_ATY_GX y # Mach64 GX support
+      FB_SAVAGE_I2C y
+      FB_SAVAGE_ACCEL y
+      FB_SIS_300 y
+      FB_SIS_315 y
+      FB_3DFX_ACCEL y
+      FB_GEODE y
+
+      # Video configuration
+      # The intel drivers already require KMS
+      DRM_I915_KMS y
+      # Hybrid graphics support
+      VGA_SWITCHEROO y
+
+      # Sound.
+      SND_AC97_POWER_SAVE y # AC97 Power-Saving Mode
+      SND_HDA_INPUT_BEEP y # Support digital beep via input layer
+      SND_USB_CAIAQ_INPUT y
+      PSS_MIXER y # Enable PSS mixer (Beethoven ADSP-16 and other compatible)
+
+      # USB serial devices.
+      USB_SERIAL_GENERIC y # USB Generic Serial Driver
+      USB_SERIAL_KEYSPAN_MPR y # include firmware for various USB serial devices
+      USB_SERIAL_KEYSPAN_USA28 y
+      USB_SERIAL_KEYSPAN_USA28X y
+      USB_SERIAL_KEYSPAN_USA28XA y
+      USB_SERIAL_KEYSPAN_USA28XB y
+      USB_SERIAL_KEYSPAN_USA19 y
+      USB_SERIAL_KEYSPAN_USA18X y
+      USB_SERIAL_KEYSPAN_USA19W y
+      USB_SERIAL_KEYSPAN_USA19QW y
+      USB_SERIAL_KEYSPAN_USA19QI y
+      USB_SERIAL_KEYSPAN_USA49W y
+      USB_SERIAL_KEYSPAN_USA49WLC y
+
+      # Filesystem options - in particular, enable extended attributes and
+      # ACLs for all filesystems that support them.
+      EXT2_FS_XATTR y # Ext2 extended attributes
+      EXT2_FS_POSIX_ACL y # Ext2 POSIX Access Control Lists
+      EXT2_FS_SECURITY y # Ext2 Security Labels
+      EXT2_FS_XIP y # Ext2 execute in place support
+      EXT4_FS_POSIX_ACL y
+      EXT4_FS_SECURITY y
+      REISERFS_FS_XATTR y
+      REISERFS_FS_POSIX_ACL y
+      REISERFS_FS_SECURITY y
+      JFS_POSIX_ACL y
+      JFS_SECURITY y
+      XFS_QUOTA y
+      XFS_POSIX_ACL y
+      XFS_RT y # XFS Realtime subvolume support
+      OCFS2_DEBUG_MASKLOG n
+      BTRFS_FS_POSIX_ACL y
+      UBIFS_FS_XATTR y
+      UBIFS_FS_ADVANCED_COMPR y
+      NFSD_V2_ACL y
+      NFSD_V3 y
+      NFSD_V3_ACL y
+      NFSD_V4 y
+      CIFS_XATTR y
+      CIFS_POSIX y
+
+      # Security related features.
+      STRICT_DEVMEM y # Filter access to /dev/mem
+      SECURITY_SELINUX_BOOTPARAM_VALUE 0 # disable SELinux by default
+
+      # Misc. options.
+      8139TOO_8129 y
+      8139TOO_PIO n # PIO is slower
+      AIC79XX_DEBUG_ENABLE n
+      AIC7XXX_DEBUG_ENABLE n
+      AIC94XX_DEBUG n
+      B43_PCMCIA y
+      BLK_DEV_CMD640_ENHANCED y # CMD640 enhanced support
+      BLK_DEV_IDEACPI y # IDE ACPI support
+      BLK_DEV_INTEGRITY y
+      BSD_PROCESS_ACCT_V3 y
+      BT_HCIUART_BCSP y
+      BT_HCIUART_H4 y # UART (H4) protocol support
+      BT_HCIUART_LL y
+      BT_L2CAP y
+      BT_RFCOMM m
+      BT_RFCOMM_TTY y # RFCOMM TTY support
+      CRASH_DUMP n
+      DMAR? n # experimental
+      DVB_DYNAMIC_MINORS y # we use udev
+      FUSION y # Fusion MPT device support
+      IDE_GD_ATAPI y # ATAPI floppy support
+      IRDA_ULTRA y # Ultra (connectionless) protocol
+      JOYSTICK_IFORCE_232 y # I-Force Serial joysticks and wheels
+      JOYSTICK_IFORCE_USB y # I-Force USB joysticks and wheels
+      JOYSTICK_XPAD_FF y # X-Box gamepad rumble support
+      JOYSTICK_XPAD_LEDS y # LED Support for Xbox360 controller 'BigX' LED
+      LDM_PARTITION y # Windows Logical Disk Manager (Dynamic Disk) support
+      LEDS_TRIGGER_IDE_DISK y # LED IDE Disk Trigger
+      LOGIRUMBLEPAD2_FF y # Logitech Rumblepad 2 force feedback
+      LOGO n # not needed
+      MEDIA_ATTACH y
+      MEGARAID_NEWGEN y
+      MICROCODE_AMD y
+      MODVERSIONS y
+      MOUSE_PS2_ELANTECH y # Elantech PS/2 protocol extension
+      MTRR_SANITIZER y
+      NET_FC y # Fibre Channel driver support
+      PPP_MULTILINK y # PPP multilink support
+      REGULATOR y # Voltage and Current Regulator Support
+      SCSI_LOGGING y # SCSI logging facility
+      SERIAL_8250 y # 8250/16550 and compatible serial support
+      SLIP_COMPRESSED y # CSLIP compressed headers
+      SLIP_SMART y
+      THERMAL_HWMON y # Hardware monitoring support
+      USB_DEBUG n
+      USB_EHCI_ROOT_HUB_TT y # Root Hub Transaction Translators
+      X86_CHECK_BIOS_CORRUPTION y
+      X86_MCE y
+
+      # Linux Containers
+      RT_GROUP_SCHED? y
+      CGROUP_DEVICE? y
+      CGROUP_MEM_RES_CTLR? y
+      CGROUP_MEM_RES_CTLR_SWAP? y
+      DEVPTS_MULTIPLE_INSTANCES? y
+
+      ${if kernelPlatform ? kernelExtraConfig then kernelPlatform.kernelExtraConfig else ""}
+      ${extraConfig}
+    '';
+in
+
+import ./generic.nix (
+
+  rec {
+    version = "3.0.4";
+  
+    src = fetchurl {
+      url = "mirror://kernel/linux/kernel/v3.x/linux-${version}.tar.bz2";
+      sha256 = "1vypjcdii75h5f4zsw9lm8wzxd5ix0mk5p94c96hxv828mqqkmhk";
+    };
+
+    config = configWithPlatform stdenv.platform;
+    configCross = configWithPlatform stdenv.cross.platform;
+
+    setModuleDir = false;
+
+    features.iwlwifi = true;
+  }
+
+  // removeAttrs args ["extraConfig"]
+)
diff --git a/pkgs/os-specific/linux/kernel/linux-3.1.nix b/pkgs/os-specific/linux/kernel/linux-3.1.nix
new file mode 100644
index 0000000000000..a513dc0f057e9
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/linux-3.1.nix
@@ -0,0 +1,220 @@
+args @ { stdenv, fetchurl, userModeLinux ? false, extraConfig ? ""
+, perl, mktemp, module_init_tools
+, ... }:
+
+let
+  configWithPlatform = kernelPlatform :
+    ''
+      # Don't include any debug features.
+      DEBUG_KERNEL n
+
+      # Support drivers that need external firmware.
+      STANDALONE n
+
+      # Make /proc/config.gz available.
+      IKCONFIG_PROC y
+
+      # Optimize with -O2, not -Os.
+      CC_OPTIMIZE_FOR_SIZE n
+
+      # Enable the kernel's built-in memory tester.
+      MEMTEST y
+
+      # Disable some expensive (?) features.
+      FTRACE n
+      KPROBES n
+      NUMA? n
+      PM_TRACE_RTC n
+
+      # Enable various subsystems.
+      ACCESSIBILITY y # Accessibility support
+      AUXDISPLAY y # Auxiliary Display support
+      DONGLE y # Serial dongle support
+      HIPPI y
+      MTD_COMPLEX_MAPPINGS y # needed for many devices
+      NET_POCKET y # enable pocket and portable adapters
+      SCSI_LOWLEVEL y # enable lots of SCSI devices
+      SCSI_LOWLEVEL_PCMCIA y
+      SPI y # needed for many devices
+      SPI_MASTER y
+      WAN y
+
+      # Networking options.
+      IP_PNP n
+      IPV6_PRIVACY y
+      NETFILTER_ADVANCED y
+      IP_VS_PROTO_TCP y
+      IP_VS_PROTO_UDP y
+      IP_VS_PROTO_ESP y
+      IP_VS_PROTO_AH y
+      IP_DCCP_CCID3 n # experimental
+      CLS_U32_PERF y
+      CLS_U32_MARK y
+
+      # Wireless networking.
+      IPW2100_MONITOR y # support promiscuous mode
+      IPW2200_MONITOR y # support promiscuous mode
+      HOSTAP_FIRMWARE y # Support downloading firmware images with Host AP driver
+      HOSTAP_FIRMWARE_NVRAM y
+      ATH9K_PCI y # Detect Atheros AR9xxx cards on PCI(e) bus
+      ATH9K_AHB y # Ditto, AHB bus
+
+      # Some settings to make sure that fbcondecor works - in particular,
+      # disable tileblitting and the drivers that need it.
+
+      # Enable various FB devices.
+      FB y
+      FB_EFI y
+      FB_NVIDIA_I2C y # Enable DDC Support
+      FB_RIVA_I2C y
+      FB_ATY_CT y # Mach64 CT/VT/GT/LT (incl. 3D RAGE) support
+      FB_ATY_GX y # Mach64 GX support
+      FB_SAVAGE_I2C y
+      FB_SAVAGE_ACCEL y
+      FB_SIS_300 y
+      FB_SIS_315 y
+      FB_3DFX_ACCEL y
+      FB_GEODE y
+
+      # Video configuration
+      # The intel drivers already require KMS
+      DRM_I915_KMS y
+      # Hybrid graphics support
+      VGA_SWITCHEROO y
+
+      # Sound.
+      SND_AC97_POWER_SAVE y # AC97 Power-Saving Mode
+      SND_HDA_INPUT_BEEP y # Support digital beep via input layer
+      SND_USB_CAIAQ_INPUT y
+      PSS_MIXER y # Enable PSS mixer (Beethoven ADSP-16 and other compatible)
+
+      # USB serial devices.
+      USB_SERIAL_GENERIC y # USB Generic Serial Driver
+      USB_SERIAL_KEYSPAN_MPR y # include firmware for various USB serial devices
+      USB_SERIAL_KEYSPAN_USA28 y
+      USB_SERIAL_KEYSPAN_USA28X y
+      USB_SERIAL_KEYSPAN_USA28XA y
+      USB_SERIAL_KEYSPAN_USA28XB y
+      USB_SERIAL_KEYSPAN_USA19 y
+      USB_SERIAL_KEYSPAN_USA18X y
+      USB_SERIAL_KEYSPAN_USA19W y
+      USB_SERIAL_KEYSPAN_USA19QW y
+      USB_SERIAL_KEYSPAN_USA19QI y
+      USB_SERIAL_KEYSPAN_USA49W y
+      USB_SERIAL_KEYSPAN_USA49WLC y
+
+      # Filesystem options - in particular, enable extended attributes and
+      # ACLs for all filesystems that support them.
+      EXT2_FS_XATTR y # Ext2 extended attributes
+      EXT2_FS_POSIX_ACL y # Ext2 POSIX Access Control Lists
+      EXT2_FS_SECURITY y # Ext2 Security Labels
+      EXT2_FS_XIP y # Ext2 execute in place support
+      EXT4_FS_POSIX_ACL y
+      EXT4_FS_SECURITY y
+      REISERFS_FS_XATTR y
+      REISERFS_FS_POSIX_ACL y
+      REISERFS_FS_SECURITY y
+      JFS_POSIX_ACL y
+      JFS_SECURITY y
+      XFS_QUOTA y
+      XFS_POSIX_ACL y
+      XFS_RT y # XFS Realtime subvolume support
+      OCFS2_DEBUG_MASKLOG n
+      BTRFS_FS_POSIX_ACL y
+      UBIFS_FS_XATTR y
+      UBIFS_FS_ADVANCED_COMPR y
+      NFSD_V2_ACL y
+      NFSD_V3 y
+      NFSD_V3_ACL y
+      NFSD_V4 y
+      CIFS_XATTR y
+      CIFS_POSIX y
+
+      # Security related features.
+      STRICT_DEVMEM y # Filter access to /dev/mem
+      SECURITY_SELINUX_BOOTPARAM_VALUE 0 # disable SELinux by default
+
+      # Misc. options.
+      8139TOO_8129 y
+      8139TOO_PIO n # PIO is slower
+      AIC79XX_DEBUG_ENABLE n
+      AIC7XXX_DEBUG_ENABLE n
+      AIC94XX_DEBUG n
+      B43_PCMCIA y
+      BLK_DEV_CMD640_ENHANCED y # CMD640 enhanced support
+      BLK_DEV_IDEACPI y # IDE ACPI support
+      BLK_DEV_INTEGRITY y
+      BSD_PROCESS_ACCT_V3 y
+      BT_HCIUART_BCSP y
+      BT_HCIUART_H4 y # UART (H4) protocol support
+      BT_HCIUART_LL y
+      BT_L2CAP y
+      BT_RFCOMM m
+      BT_RFCOMM_TTY y # RFCOMM TTY support
+      CRASH_DUMP n
+      DMAR? n # experimental
+      DVB_DYNAMIC_MINORS y # we use udev
+      FUSION y # Fusion MPT device support
+      IDE_GD_ATAPI y # ATAPI floppy support
+      IRDA_ULTRA y # Ultra (connectionless) protocol
+      JOYSTICK_IFORCE_232 y # I-Force Serial joysticks and wheels
+      JOYSTICK_IFORCE_USB y # I-Force USB joysticks and wheels
+      JOYSTICK_XPAD_FF y # X-Box gamepad rumble support
+      JOYSTICK_XPAD_LEDS y # LED Support for Xbox360 controller 'BigX' LED
+      LDM_PARTITION y # Windows Logical Disk Manager (Dynamic Disk) support
+      LEDS_TRIGGER_IDE_DISK y # LED IDE Disk Trigger
+      LOGIRUMBLEPAD2_FF y # Logitech Rumblepad 2 force feedback
+      LOGO n # not needed
+      MEDIA_ATTACH y
+      MEGARAID_NEWGEN y
+      MICROCODE_AMD y
+      MODVERSIONS y
+      MOUSE_PS2_ELANTECH y # Elantech PS/2 protocol extension
+      MTRR_SANITIZER y
+      NET_FC y # Fibre Channel driver support
+      PPP_MULTILINK y # PPP multilink support
+      REGULATOR y # Voltage and Current Regulator Support
+      SCSI_LOGGING y # SCSI logging facility
+      SERIAL_8250 y # 8250/16550 and compatible serial support
+      SLIP_COMPRESSED y # CSLIP compressed headers
+      SLIP_SMART y
+      THERMAL_HWMON y # Hardware monitoring support
+      USB_DEBUG n
+      USB_EHCI_ROOT_HUB_TT y # Root Hub Transaction Translators
+      X86_CHECK_BIOS_CORRUPTION y
+      X86_MCE y
+
+      # Linux Containers
+      RT_GROUP_SCHED? y
+      CGROUP_DEVICE? y
+      CGROUP_MEM_RES_CTLR? y
+      CGROUP_MEM_RES_CTLR_SWAP? y
+      DEVPTS_MULTIPLE_INSTANCES? y
+
+      ${if kernelPlatform ? kernelExtraConfig then kernelPlatform.kernelExtraConfig else ""}
+      ${extraConfig}
+    '';
+in
+
+import ./generic.nix (
+
+  rec {
+    version = "3.1-rc4";
+
+    modDirVersion = "3.1.0-rc4";
+  
+    src = fetchurl {
+      url = "mirror://kernel/linux/kernel/v3.x/testing/linux-${version}.tar.bz2";
+      sha256 = "1inb4iyj9r7lk68bw1mznxk726n3cxcbylqnb62ycisi1z2gxwjw";
+    };
+
+    config = configWithPlatform stdenv.platform;
+    configCross = configWithPlatform stdenv.cross.platform;
+
+    setModuleDir = false;
+
+    features.iwlwifi = true;
+  }
+
+  // removeAttrs args ["extraConfig"]
+)
diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix
index 902be41f874c5..2b0d76d76edba 100644
--- a/pkgs/os-specific/linux/kernel/patches.nix
+++ b/pkgs/os-specific/linux/kernel/patches.nix
@@ -164,22 +164,22 @@ rec {
     };
 
   tracehook_2_6_32 =
-    { # From <http://people.redhat.com/roland/utrace/>.
+    { # From <http://userweb.kernel.org/~frob/utrace/>.
       name = "tracehook";
       patch = fetchurl {
-        url = http://people.redhat.com/roland/utrace/2.6.32/tracehook.patch;
+        url = http://userweb.kernel.org/~frob/utrace/2.6.32/tracehook.patch;
         sha256 = "1y009p8dyqknbjm8ryb495jqmvl372gfhswdn167xh2g1f24xqv8";
       };
     };
 
   utrace_2_6_32 =
-    { # From <http://people.redhat.com/roland/utrace/>, depends on the
+    { # From <http://userweb.kernel.org/~frob/utrace/>, depends on the
       # `tracehook' patch above.
       # See also <http://sourceware.org/systemtap/wiki/utrace>.
       name = "utrace";
       patch = fetchurl {
-        url = http://people.redhat.com/roland/utrace/2.6.32/utrace.patch;
-        sha256 = "1951mwc8jfiwrl0d2bb1zk9yrl7n7kadc00ymjsxrg2irda1b89r";
+        url = http://userweb.kernel.org/~frob/utrace/2.6.32/utrace.patch;
+        sha256 = "0argf19k9f0asiv4l4cnsxm5hw2xx8d794npaln88vwz87sj5nnq";
       };
       extraConfig =
         '' UTRACE y
@@ -195,6 +195,15 @@ rec {
       features.aufsBase = true;
     };
 
+  aufs2_2_6_33 =
+    { # From http://git.c3sl.ufpr.br/gitweb?p=aufs/aufs2-standalone.git;a=tree;h=refs/heads/aufs2-33;hb=aufs2-33
+      # Note that this merely the patch needed to build AUFS2 as a
+      # standalone package.
+      name = "aufs2";
+      patch = ./aufs2-33.patch;
+      features.aufsBase = true;
+    };
+
   aufs2_2_6_34 =
     { # From http://git.c3sl.ufpr.br/gitweb?p=aufs/aufs2-standalone.git;a=tree;h=refs/heads/aufs2-34;hb=aufs2-34
       # Note that this merely the patch needed to build AUFS2 as a
@@ -213,6 +222,16 @@ rec {
       features.aufsBase = true;
     };
 
+  aufs2_2_6_36 =
+    { # From http://git.c3sl.ufpr.br/gitweb?p=aufs/aufs2-standalone.git;a=tree;h=refs/heads/aufs2.1-36;hb=aufs2.1-36
+      # Note that this merely the patch needed to build AUFS2 as a
+      # standalone package.
+      name = "aufs2";
+      patch = ./aufs2.1-36.patch;
+      features.aufsBase = true;
+      features.aufs2_1 = true;
+    };
+
   aufs2_1_2_6_37 =
     { # From http://git.c3sl.ufpr.br/gitweb?p=aufs/aufs2-standalone.git;a=tree;h=refs/heads/aufs2.1-37;hb=refs/heads/aufs2.1-37
       # Note that this merely the patch needed to build AUFS2.1 as a
@@ -233,6 +252,26 @@ rec {
       features.aufs2_1 = true;
     };
 
+  aufs2_1_2_6_39 =
+    { # From http://aufs.git.sourceforge.net/git/gitweb.cgi?p=aufs/aufs2-standalone.git;a=tree;h=refs/heads/aufs2.1-39;hb=refs/heads/aufs2.1-39
+      # Note that this merely the patch needed to build AUFS2.1 as a
+      # standalone package.
+      name = "aufs2.1";
+      patch = ./aufs2.1-39.patch;
+      features.aufsBase = true;
+      features.aufs2_1 = true;
+    };
+
+  aufs2_1_3_0 =
+    { # From http://aufs.git.sourceforge.net/git/gitweb.cgi?p=aufs/aufs2-standalone.git;a=tree;h=ac52a37b0debba539bdfabba101f82b99136b380;hb=ac52a37b0debba539bdfabba101f82b99136b380
+      # Note that this merely the patch needed to build AUFS2.1 as a
+      # standalone package.
+      name = "aufs2.1";
+      patch = ./aufs2.1-3.0.patch;
+      features.aufsBase = true;
+      features.aufs2_1 = true;
+    };
+
   # Increase the timeout on CIFS requests from 15 to 120 seconds to
   # make CIFS more resilient to high load on the CIFS server.
   cifs_timeout_2_6_15 =
diff --git a/pkgs/os-specific/linux/libatasmart/default.nix b/pkgs/os-specific/linux/libatasmart/default.nix
new file mode 100644
index 0000000000000..86dffde4b557c
--- /dev/null
+++ b/pkgs/os-specific/linux/libatasmart/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl, pkgconfig, udev }:
+
+stdenv.mkDerivation rec {
+  name = "libatasmart-0.17";
+
+  src = fetchurl {
+    url = "http://0pointer.de/public/${name}.tar.gz";
+    sha256 = "1zazxnqsirlv9gkzij6z31b21gv2nv7gkpja0wpxwb7kfh9a2qid";
+  };
+
+  buildInputs = [ pkgconfig udev ];
+
+  meta = {
+    homepage = http://0pointer.de/public/;
+    description = "Library for querying ATA SMART status";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/os-specific/linux/libnl/v2.nix b/pkgs/os-specific/linux/libnl/v2.nix
index cbe938d2ee411..cb5c022c3d4c3 100644
--- a/pkgs/os-specific/linux/libnl/v2.nix
+++ b/pkgs/os-specific/linux/libnl/v2.nix
@@ -9,7 +9,6 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ bison flex ];
-  postConfigure = "type -tp flex";
 
   meta = {
     homepage = "http://www.infradead.org/~tgr/libnl/";
diff --git a/pkgs/os-specific/linux/lvm2/default.nix b/pkgs/os-specific/linux/lvm2/default.nix
index 9a2dc2d28ace4..037a3d227c461 100644
--- a/pkgs/os-specific/linux/lvm2/default.nix
+++ b/pkgs/os-specific/linux/lvm2/default.nix
@@ -1,26 +1,30 @@
-{ stdenv, fetchurl, udev }:
+{ stdenv, fetchurl, pkgconfig, udev }:
 
 let
-  v = "2.02.65";
+  v = "2.02.87";
 in
 
 stdenv.mkDerivation {
   name = "lvm2-${v}";
-  
+
   src = fetchurl {
     url = "ftp://sources.redhat.com/pub/lvm2/old/LVM2.${v}.tgz";
-    sha256 = "1lbskrj4pxbipq8f0qhql3p1nqa796v4i1cy6n2fmmbs3fwmfh9a";
+    sha256 = "04d605dac9r0yz9khx9pq6a8jdsf9arda2rz1a2d1qr3jhlw4kvg";
   };
-  
-  configureFlags = "--disable-readline --enable-udev_rules --enable-udev_sync";
 
-  buildInputs = [ udev ];
-  
+  configureFlags =
+    "--disable-readline --enable-udev_rules --enable-udev_sync --enable-pkgconfig --enable-applib";
+
+  buildInputs = [ pkgconfig udev ];
+
+  patches = [ ./purity.patch ];
+
   # To prevent make install from failing.
   preInstall = "installFlags=\"OWNER= GROUP= confdir=$out/etc\"";
 
   meta = {
     homepage = http://sourceware.org/lvm2/;
     descriptions = "Tools to support Logical Volume Management (LVM) on Linux";
+    platforms = stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/lvm2/purity.patch b/pkgs/os-specific/linux/lvm2/purity.patch
new file mode 100644
index 0000000000000..8446e8e9ee9d6
--- /dev/null
+++ b/pkgs/os-specific/linux/lvm2/purity.patch
@@ -0,0 +1,55 @@
+TODO: fix path to blkid as well.
+
+Currently we set it to /sbin/blkid because in nixos we fix a lot of references
+to /sbin/blkid anyway.
+
+diff --git a/udev/10-dm.rules.in b/udev/10-dm.rules.in
+index 605e088..8865d54 100644
+--- a/udev/10-dm.rules.in
++++ b/udev/10-dm.rules.in
+@@ -19,9 +19,8 @@ KERNEL=="device-mapper", NAME="(DM_DIR)/control"
+ SUBSYSTEM!="block", GOTO="dm_end"
+ KERNEL!="dm-[0-9]*", GOTO="dm_end"
+ 
+-# Set proper sbin path, /sbin has higher priority than /usr/sbin.
+-ENV{DM_SBIN_PATH}="/sbin"
+-TEST!="$env{DM_SBIN_PATH}/dmsetup", ENV{DM_SBIN_PATH}="/usr/sbin"
++# Set proper sbin path. Exit if dmsetup is not present.
++ENV{DM_SBIN_PATH}="(sbindir)"
+ TEST!="$env{DM_SBIN_PATH}/dmsetup", GOTO="dm_end"
+ 
+ # Device created, major and minor number assigned - "add" event generated.
+diff --git a/udev/13-dm-disk.rules b/udev/13-dm-disk.rules
+index 271ca22..cdc583f 100644
+--- a/udev/13-dm-disk.rules
++++ b/udev/13-dm-disk.rules
+@@ -19,7 +19,7 @@ ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}"
+ 
+ ENV{DM_SUSPENDED}=="1", GOTO="dm_end"
+ 
+-IMPORT{program}="$env{DM_SBIN_PATH}/blkid -o udev -p $tempnode"
++IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
+ ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS="link_priority=-100"
+ ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
+diff --git a/udev/Makefile.in b/udev/Makefile.in
+index 11635bb..49cf732 100644
+--- a/udev/Makefile.in
++++ b/udev/Makefile.in
+@@ -12,6 +12,7 @@
+ # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ 
+ srcdir = @srcdir@
++sbindir = @sbindir@
+ top_srcdir = @top_srcdir@
+ top_builddir = @top_builddir@
+ 
+@@ -26,7 +27,7 @@ include $(top_builddir)/make.tmpl
+ vpath %.rules $(srcdir)
+ 
+ %.rules: %.rules.in
+-	$(SED) -e "s/(DM_DIR)/$(DM_DIR)/" $< >$@
++	$(SED) -e "s/(DM_DIR)/$(DM_DIR)/" -e "s|(sbindir)|$(sbindir)|" $< >$@
+ 
+ %_install: %.rules
+ 	$(INSTALL_DATA) -D $< $(udevdir)/$(<F)
diff --git a/pkgs/os-specific/linux/mountall/default.nix b/pkgs/os-specific/linux/mountall/default.nix
index 134f7577c96da..d3b0311b449ad 100644
--- a/pkgs/os-specific/linux/mountall/default.nix
+++ b/pkgs/os-specific/linux/mountall/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, pkgconfig, libnih, dbus, udev, autoconf, automake, libtool, gettext }:
    
 stdenv.mkDerivation {
-  name = "mountall-2.15";
+  name = "mountall-2.31";
    
   src = fetchurl {
-    url = https://launchpad.net/ubuntu/+archive/primary/+files/mountall_2.15.tar.gz;
-    sha256 = "1ik9r1av0f17byfxr4l2w0qpaijxkfqvxws6gmc98liq6fyyzn4v";
+    url = https://launchpad.net/ubuntu/+archive/primary/+files/mountall_2.31.tar.gz;
+    sha256 = "09885v82kd8x7yf18vw7h6z4816jvn7gmjx5vicxlg4pqlzwqvhv";
   };
 
   patches = [ ./no-plymouth.patch ];
@@ -14,6 +14,8 @@ stdenv.mkDerivation {
 
   buildInputs = [ pkgconfig libnih dbus.libs udev autoconf automake libtool gettext ];
 
+  makeFlags = "initramfshookdir=$(out)/share/initramfs-tools/hooks upstart_jobs_initramfs_configdir=$(out)/share/initramfs-tools/event-driven/upstart-jobs";
+  
   meta = {
     homepage = https://launchpad.net/ubuntu/+source/mountall;
     description = "Utility to mount all filesystems and emit Upstart events";
diff --git a/pkgs/os-specific/linux/mountall/no-plymouth.patch b/pkgs/os-specific/linux/mountall/no-plymouth.patch
index 6bf8c95276bac..890dab9bc885c 100644
--- a/pkgs/os-specific/linux/mountall/no-plymouth.patch
+++ b/pkgs/os-specific/linux/mountall/no-plymouth.patch
@@ -1,6 +1,6 @@
-diff -ru -x '*~' mountall-2.15-orig/configure.ac mountall-2.15/configure.ac
---- mountall-2.15-orig/configure.ac	2010-05-09 01:42:22.000000000 +0200
-+++ mountall-2.15/configure.ac	2010-06-03 13:46:09.000000000 +0200
+diff -ru -x '*~' mountall-2.31-orig/configure.ac mountall-2.31/configure.ac
+--- mountall-2.31-orig/configure.ac	2011-07-15 14:00:15.000000000 +0200
++++ mountall-2.31/configure.ac	2011-07-25 00:13:13.000000000 +0200
 @@ -29,7 +29,7 @@
  PKG_CHECK_MODULES([NIH_DBUS], [libnih-dbus >= 1.0.0])
  PKG_CHECK_MODULES([DBUS], [dbus-1 >= 1.2.16])
@@ -10,9 +10,9 @@ diff -ru -x '*~' mountall-2.15-orig/configure.ac mountall-2.15/configure.ac
  
  # Checks for header files.
  
-diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
---- mountall-2.15-orig/src/mountall.c	2010-05-09 01:42:24.000000000 +0200
-+++ mountall-2.15/src/mountall.c	2010-07-07 14:40:47.000000000 +0200
+diff -ru -x '*~' mountall-2.31-orig/src/mountall.c mountall-2.31/src/mountall.c
+--- mountall-2.31-orig/src/mountall.c	2011-07-15 14:00:15.000000000 +0200
++++ mountall-2.31/src/mountall.c	2011-07-25 00:21:13.000000000 +0200
 @@ -64,8 +64,10 @@
  #include <nih-dbus/dbus_proxy.h>
  #include <nih-dbus/errors.h>
@@ -24,16 +24,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  
  #include "ioprio.h"
  
-@@ -75,7 +77,7 @@
- 
- #define BUILTIN_FSTAB   "/lib/init/fstab"
- 
--#define BOREDOM_TIMEOUT 3
-+#define BOREDOM_TIMEOUT 15
- 
- enum exit {
- 	EXIT_OK = 0,		/* Ok */
-@@ -214,15 +216,19 @@
+@@ -219,15 +221,19 @@
  void   boredom_timeout       (void *data, NihTimer *timer);
  
  int    plymouth_connect      (void);
@@ -52,8 +43,8 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
 +#endif
  
  void   usr1_handler          (void *data, NihSignal *signal);
- 
-@@ -241,8 +247,10 @@
+ int    set_dev_wait_time        (NihOption *option, const char *arg);
+@@ -247,8 +253,10 @@
   **/
  size_t num_local = 0;
  size_t num_local_mounted = 0;
@@ -64,7 +55,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  size_t num_virtual = 0;
  size_t num_virtual_mounted = 0;
  size_t num_swap = 0;
-@@ -310,6 +318,7 @@
+@@ -318,6 +326,7 @@
   **/
  static struct udev *udev = NULL;
  
@@ -72,7 +63,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  /**
   * ply_event_loop:
   *
-@@ -323,6 +332,7 @@
+@@ -331,6 +340,7 @@
   * Plymouth boot client.
   **/
  static ply_boot_client_t *ply_boot_client = NULL;
@@ -80,7 +71,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  
  /**
   * plymouth_error:
-@@ -1208,11 +1218,12 @@
+@@ -1253,11 +1263,12 @@
  			nih_debug ("%s is root filesystem", MOUNT_NAME (mnt));
  			tag = TAG_LOCAL;
  		} else if (is_remote (mnt)) {
@@ -95,7 +86,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  			{
  				tag = TAG_REMOTE;
  			} else {
-@@ -1475,7 +1486,8 @@
+@@ -1566,7 +1577,8 @@
  	/* Enforce local only after virtual filesystems triggered */
  	if ((! local_triggered)
  	    && virtual_triggered
@@ -105,7 +96,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  		nih_info (_("%s finished"), "local");
  		emit_event ("local-filesystems", NULL);
  		local_triggered = TRUE;
-@@ -1484,7 +1496,8 @@
+@@ -1575,7 +1587,8 @@
  	/* Enforce remote only after virtual filesystems triggrered */
  	if ((! remote_triggered)
  	    && virtual_triggered
@@ -115,7 +106,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  		nih_info (_("%s finished"), "remote");
  		emit_event ("remote-filesystems", NULL);
  		remote_triggered = TRUE;
-@@ -1494,7 +1507,9 @@
+@@ -1585,7 +1598,9 @@
  	if ((! filesystem_triggered)
  	    && virtual_triggered
  	    && local_triggered
@@ -126,7 +117,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  		nih_info (_("All filesystems mounted"));
  		emit_event ("filesystem", NULL);
  		filesystem_triggered = TRUE;
-@@ -1508,9 +1523,9 @@
+@@ -1599,9 +1614,9 @@
  		swap_triggered = TRUE;
  	}
  
@@ -139,7 +130,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  		   num_virtual_mounted, num_virtual,
  		   num_swap_mounted, num_swap);
  }
-@@ -2203,12 +2218,14 @@
+@@ -2442,12 +2457,14 @@
  	if (no_events)
  		return;
  
@@ -155,7 +146,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  	env = NIH_MUST (nih_str_array_new (NULL));
  
  	if (mnt) {
-@@ -2787,6 +2804,7 @@
+@@ -3026,6 +3043,7 @@
  int
  plymouth_connect (void)
  {
@@ -163,7 +154,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  	/* If we were already connected, just re-use that connection */
  	if (ply_boot_client)
  		return TRUE;
-@@ -2813,8 +2831,13 @@
+@@ -3052,8 +3070,13 @@
  	nih_info (_("Connected to Plymouth"));
  
  	return TRUE;
@@ -177,7 +168,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  void
  plymouth_disconnected (void *             user_data,
  		       ply_boot_client_t *client)
-@@ -2827,6 +2850,7 @@
+@@ -3066,6 +3089,7 @@
  	ply_boot_client_free (ply_boot_client);
  	ply_boot_client = NULL;
  }
@@ -185,7 +176,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  
  
  void
-@@ -2837,6 +2861,7 @@
+@@ -3076,6 +3100,7 @@
  
  	nih_assert (mnt != NULL);
  
@@ -193,7 +184,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  	/* No Plymouth => no progress information */
  	if (! plymouth_connect ())
  		return;
-@@ -2866,6 +2891,7 @@
+@@ -3105,6 +3130,7 @@
  				       plymouth_response,
  				       plymouth_failed,
  				       NULL);
@@ -201,7 +192,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  }
  
  void
-@@ -2881,20 +2907,31 @@
+@@ -3120,20 +3146,31 @@
  		NIH_LIST_FOREACH (mounts, iter) {
  			Mount *mnt = (Mount *)iter;
  
@@ -235,7 +226,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  	/* If we're already displaying messages, don't change them unless
  	 * the message is no longer valid for that mount point; otherwise
  	 * clear the message.
-@@ -3005,8 +3042,10 @@
+@@ -3244,8 +3281,10 @@
  							   plymouth_answer,
  							   plymouth_failed,
  							   NULL);
@@ -246,16 +237,23 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  void
  plymouth_response (void *             user_data,
  		   ply_boot_client_t *client)
-@@ -3125,7 +3164,7 @@
+@@ -3364,6 +3403,7 @@
  		break;
  	}
  }
--
 +#endif
  
+ /*
+  * set_dev_wait_time:
+@@ -3399,7 +3439,6 @@
+         return err;
+ }
  
+-
  /**
-@@ -3211,6 +3250,7 @@
+  * stop_mountpoint_timer:
+  * @mountpoint: mountpoint whose timer you want to stop.
+@@ -3673,6 +3712,7 @@
  				    (NihIoWatcher)udev_monitor_watcher,
  				    udev_monitor));
  
@@ -263,7 +261,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  	/* Initialise a Plymouth event loop; this is an epoll instance that
  	 * we can poll within our own main loop and call out to when needs
  	 * be.
-@@ -3224,6 +3264,7 @@
+@@ -3686,6 +3726,7 @@
  
  	/* Attempt an early connection to Plymouth */
  	plymouth_connect ();
@@ -271,7 +269,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  
  	mounts = NIH_MUST (nih_list_new (NULL));
  
-@@ -3236,7 +3277,9 @@
+@@ -3698,7 +3739,9 @@
  	 * from /etc/fstab and /proc/self/mountinfo to find out what else
  	 * we need to do.
  	 */
@@ -281,7 +279,7 @@ diff -ru -x '*~' mountall-2.15-orig/src/mountall.c mountall-2.15/src/mountall.c
  	parse_fstab (_PATH_MNTTAB);
  	parse_mountinfo ();
  
-@@ -3338,10 +3381,12 @@
+@@ -3822,10 +3865,12 @@
  	/* Flush the D-Bus connection to ensure all messages are sent */
  	dbus_connection_flush (connection);
  
diff --git a/pkgs/os-specific/linux/multipath-tools/default.nix b/pkgs/os-specific/linux/multipath-tools/default.nix
index b25321ca779cf..90722d74ace15 100644
--- a/pkgs/os-specific/linux/multipath-tools/default.nix
+++ b/pkgs/os-specific/linux/multipath-tools/default.nix
@@ -22,8 +22,8 @@ stdenv.mkDerivation rec {
       substituteInPlace kpartx/kpartx.rules --replace /sbin/kpartx $out/sbin/kpartx
       substituteInPlace kpartx/kpartx_id --replace /sbin/dmsetup ${lvm2}/sbin/dmsetup
 
-      substituteInPlace libmultipath/defaults.h --replace /lib/udev/scsi_id ${udev}/libexec/scsi_id
-      substituteInPlace libmultipath/hwtable.c --replace /lib/udev/scsi_id ${udev}/libexec/scsi_id
+      substituteInPlace libmultipath/defaults.h --replace /lib/udev/scsi_id ${udev}/lib/udev/scsi_id
+      substituteInPlace libmultipath/hwtable.c --replace /lib/udev/scsi_id ${udev}/lib/udev/scsi_id
     '';
 
   meta = {
diff --git a/pkgs/os-specific/linux/nvidia-x11/default.nix b/pkgs/os-specific/linux/nvidia-x11/default.nix
index dec6bdbd29eb7..f2065e1aa019b 100644
--- a/pkgs/os-specific/linux/nvidia-x11/default.nix
+++ b/pkgs/os-specific/linux/nvidia-x11/default.nix
@@ -7,7 +7,7 @@
 
 with stdenv.lib;
 
-let versionNumber = "275.09.07"; in
+let versionNumber = "280.13"; in
 
 stdenv.mkDerivation {
   name = "nvidia-x11-${versionNumber}${optionalString (!libsOnly) "-${kernel.version}"}";
@@ -18,12 +18,12 @@ stdenv.mkDerivation {
     if stdenv.system == "i686-linux" then
       fetchurl {
         url = "http://us.download.nvidia.com/XFree86/Linux-x86/${versionNumber}/NVIDIA-Linux-x86-${versionNumber}.run";
-        sha256 = "037zl60adks465vpcfxb74n2h7rzfwibv07d4gj5dg8i7h3v5l97";
+        sha256 = "16xcidshamxvc80sdnkph5rpgf72m5zz4x155amg2433kkhsy8mj";
       }
     else if stdenv.system == "x86_64-linux" then
       fetchurl {
         url = "http://us.download.nvidia.com/XFree86/Linux-x86_64/${versionNumber}/NVIDIA-Linux-x86_64-${versionNumber}-no-compat32.run";
-        sha256 = "1k26z747iy0gh94288d39cgzb90wcbm339hbhd4gw3klkswhza39";
+        sha256 = "14x80qirwlfxhphzqvi92lpgs82qnzb7hq0vd02rkbwvvnkhgdxd";
       }
     else throw "nvidia-x11 does not support platform ${stdenv.system}";
 
diff --git a/pkgs/os-specific/linux/pm-utils/default.nix b/pkgs/os-specific/linux/pm-utils/default.nix
index b58555ba19f77..56fa5eed1951d 100644
--- a/pkgs/os-specific/linux/pm-utils/default.nix
+++ b/pkgs/os-specific/linux/pm-utils/default.nix
@@ -1,11 +1,22 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, coreutils, gnugrep, utillinux, module_init_tools
+, procps, kbd }:
+
+let
+
+  binPath = stdenv.lib.makeSearchPath "bin"
+    [ coreutils gnugrep utillinux module_init_tools procps kbd ];
+
+  sbinPath = stdenv.lib.makeSearchPath "sbin"
+    [ procps ];
+    
+in 
 
 stdenv.mkDerivation rec {
-  name = "pm-utils-1.3.0";
+  name = "pm-utils-1.4.1";
 
   src = fetchurl {
     url = "http://pm-utils.freedesktop.org/releases/${name}.tar.gz";
-    md5 = "37d71f8adbb409442212a85a080d324d";
+    sha256 = "02qc6zaf7ams6qcc470fwb6jvr4abv3lrlx16clqpn36501rkn4f";
   };
 
   configureFlags = "--sysconfdir=/etc";
@@ -15,9 +26,11 @@ stdenv.mkDerivation rec {
       # Install the manpages (xmlto isn't really needed).
       substituteInPlace man/Makefile.in --replace '@HAVE_XMLTO_TRUE@' ""
 
-      # Don't screw up the PATH.
-      substituteInPlace pm/pm-functions.in --replace '/sbin:/usr/sbin:/bin:/usr/bin' '$PATH'
+      # Set the PATH properly.
+      substituteInPlace pm/pm-functions.in --replace '/sbin:/usr/sbin:/bin:/usr/bin' '$PATH:${binPath}:${sbinPath}'
 
+      substituteInPlace src/pm-action.in --replace 'tr ' '${coreutils}/bin/tr '
+      
       substituteInPlace pm/sleep.d/00logging --replace /bin/uname "$(type -P uname)"
     '';
 
diff --git a/pkgs/os-specific/linux/qemu-kvm/default.nix b/pkgs/os-specific/linux/qemu-kvm/default.nix
index 59056e2feed87..745d6900e906e 100644
--- a/pkgs/os-specific/linux/qemu-kvm/default.nix
+++ b/pkgs/os-specific/linux/qemu-kvm/default.nix
@@ -1,21 +1,25 @@
 { stdenv, fetchurl, zlib, SDL, alsaLib, pkgconfig, pciutils, libuuid, vde2
-, libjpeg, libpng, ncurses }:
+, libjpeg, libpng, ncurses, python, glib }:
 
 assert stdenv.isLinux;
 
 stdenv.mkDerivation rec {
-  name = "qemu-kvm-0.14.1";
+  name = "qemu-kvm-0.15.0";
 
   src = fetchurl {
     url = "mirror://sourceforge/kvm/${name}.tar.gz";
-    sha256 = "09yshk2qzlb37hyp8iygyyf2if2d7r21b7rgkl0jyvv4p1m4z755";
+    sha256 = "0y247bc2cyawliaiyk8k41kl3mcjvh52b9bgzvxv0h55zwdpg3l2";
   };
 
   patches = [ ./smb-tmpdir.patch ];
 
+  configureFlags = "--audio-drv-list=alsa";
+
+  enableParallelBuilding = true;
+
   buildInputs =
     [ zlib SDL alsaLib pkgconfig pciutils libuuid vde2 libjpeg libpng
-      ncurses
+      ncurses python glib
     ];
 
   preBuild =
diff --git a/pkgs/os-specific/linux/rtkit/default.nix b/pkgs/os-specific/linux/rtkit/default.nix
new file mode 100644
index 0000000000000..05ebd0bf84552
--- /dev/null
+++ b/pkgs/os-specific/linux/rtkit/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl, pkgconfig, dbus, libcap }:
+
+stdenv.mkDerivation rec {
+  name = "rtkit-0.10";
+  
+  src = fetchurl {
+    url = "http://0pointer.de/public/${name}.tar.gz";
+    sha256 = "08118ya3pkxd6gbbshas23xwj483169fqmxzhp5sgmfr16n97skl";
+  };
+
+  buildInputs = [ pkgconfig dbus libcap ];
+  
+  meta = {
+    homepage = http://0pointer.de/blog/projects/rtkit;
+    descriptions = "A daemon that hands out real-time priority to processes";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/os-specific/linux/udev/166.nix b/pkgs/os-specific/linux/udev/173.nix
index 11e044244b568..ba96717e494a5 100644
--- a/pkgs/os-specific/linux/udev/166.nix
+++ b/pkgs/os-specific/linux/udev/173.nix
@@ -4,11 +4,11 @@
 assert stdenv ? glibc;
 
 stdenv.mkDerivation rec {
-  name = "udev-166";
+  name = "udev-173";
 
   src = fetchurl {
     url = "mirror://kernel/linux/utils/kernel/hotplug/${name}.tar.bz2";
-    sha256 = "1msl8cwf47shmz5lr2w9w3nzzxqnf5dc0bs7dvbnxmbal60p7lpm";
+    sha256 = "1bxadi4bi11v8ipzj22wknv8hsb0wgdb99bx3w9w33rgl4aq78bh";
   };
 
   buildInputs = [ gperf pkgconfig glib acl libusb usbutils ];
@@ -16,30 +16,36 @@ stdenv.mkDerivation rec {
   configureFlags =
     ''
       --with-pci-ids-path=${pciutils}/share/pci.ids
-      --disable-introspection
+      --enable-udev_acl --enable-edd
+      --disable-introspection --libexecdir=$(out)/lib/udev
       --with-firmware-path=/root/test-firmware:/var/run/current-system/firmware
     '';
 
+  # Workaround for the Linux kernel headers being too old.
+  NIX_CFLAGS_COMPILE = "-DBTN_TRIGGER_HAPPY=0x2c0";
+
   postInstall =
     ''
       # The path to rule_generator.functions in write_cd_rules and
       # write_net_rules is broken.  Also, don't store the mutable
       # persistant rules in /etc/udev/rules.d but in
       # /var/lib/udev/rules.d.
-      for i in $out/libexec/write_cd_rules $out/libexec/write_net_rules; do
+      for i in $out/lib/udev/write_cd_rules $out/lib/udev/write_net_rules; do
         substituteInPlace $i \
-          --replace /lib/udev $out/libexec \
+          --replace /lib/udev $out/lib/udev \
           --replace /etc/udev/rules.d /var/lib/udev/rules.d
       done
 
       # Don't set PATH to /bin:/sbin; won't work in NixOS.
-      sed -e '/PATH=/d' -i $out/libexec/rule_generator.functions
+      sed -e '/PATH=/d' -i $out/lib/udev/rule_generator.functions
 
-      ln -s $out/lib/ConsoleKit $out/etc/ConsoleKit
+      ln -sv $out/lib/ConsoleKit $out/etc/ConsoleKit
 
-      rm -rf $out/share/gtk-doc
+      rm -frv $out/share/gtk-doc
     '';
-  
+
+  patches = [ ./custom-rules.patch ];
+
   meta = {
     homepage = http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html;
     description = "Udev manages the /dev filesystem";
diff --git a/pkgs/os-specific/linux/udev/custom-rules.patch b/pkgs/os-specific/linux/udev/custom-rules.patch
new file mode 100644
index 0000000000000..647691acfb161
--- /dev/null
+++ b/pkgs/os-specific/linux/udev/custom-rules.patch
@@ -0,0 +1,91 @@
+commit c49ec33ba0f1a7f11b188913bb4895360ced67f8
+Author: Yury G. Kudryashov <urkud.urkud@gmail.com>
+Date:   Tue Aug 16 16:28:56 2011 +0400
+
+    Upstream considers presence of rules_dir=... in udev.conf as a very special case.
+    In particular, they disable /dev/.udev/*. Re-enable it.
+
+diff --git a/udev/udev-rules.c b/udev/udev-rules.c
+index 6bf2726..c1ae1f3 100644
+--- a/udev/udev-rules.c
++++ b/udev/udev-rules.c
+@@ -1812,6 +1812,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names)
+ 	struct udev_list file_list;
+ 	struct udev_list_entry *file_loop;
+ 	struct token end_token;
++	char runpathrules[UTIL_PATH_SIZE];
+ 
+ 	rules = calloc(1, sizeof(struct udev_rules));
+ 	if (rules == NULL)
+@@ -1854,22 +1855,21 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names)
+ 	rules->trie_nodes_cur = 1;
+ 
+ 	if (udev_get_rules_path(udev) == NULL) {
+-		char filename[UTIL_PATH_SIZE];
+ 
+ 		/* /lib/udev -- default/package rules */
+ 		add_matching_files(udev, &file_list, LIBEXECDIR "/rules.d", ".rules");
+ 
+ 		/* /etc/udev -- system-specific/user/admin rules */
+ 		add_matching_files(udev, &file_list, SYSCONFDIR "/udev/rules.d", ".rules");
+-
+-		/* /run/udev -- throw-away/temporary rules */
+-		util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL);
+-		add_matching_files(udev, &file_list, filename, ".rules");
+ 	} else {
+ 		/* custom rules files location for testing */
+ 		add_matching_files(udev, &file_list, udev_get_rules_path(udev), ".rules");
+ 	}
+ 
++	/* /run/udev -- throw-away/temporary rules */
++	util_strscpyl(runpathrules, sizeof(runpathrules), udev_get_run_path(udev), "/rules.d", NULL);
++	add_matching_files(udev, &file_list, runpathrules, ".rules");
++
+ 	/* add all filenames to the string buffer */
+ 	udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) {
+ 		const char *filename = udev_list_entry_get_value(file_loop);
+diff --git a/udev/udevd.c b/udev/udevd.c
+index f1a31e7..45d10b6 100644
+--- a/udev/udevd.c
++++ b/udev/udevd.c
+@@ -1198,6 +1198,8 @@ int main(int argc, char *argv[])
+ 	struct epoll_event ep_ctrl, ep_inotify, ep_signal, ep_netlink, ep_worker;
+ 	struct udev_ctrl_connection *ctrl_conn = NULL;
+ 	int rc = 1;
++	char filename[UTIL_PATH_SIZE];
++	struct stat statbuf;
+ 
+ 	udev = udev_new();
+ 	if (udev == NULL)
+@@ -1480,23 +1482,21 @@ int main(int argc, char *argv[])
+ 		inotify_add_watch(fd_inotify, udev_get_rules_path(udev),
+ 				  IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
+ 	} else {
+-		char filename[UTIL_PATH_SIZE];
+-		struct stat statbuf;
+ 
+ 		inotify_add_watch(fd_inotify, LIBEXECDIR "/rules.d",
+ 				  IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
+ 		inotify_add_watch(fd_inotify, SYSCONFDIR "/udev/rules.d",
+ 				  IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
++	}
+ 
+-		/* watch dynamic rules directory */
+-		util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL);
+-		if (stat(filename, &statbuf) != 0) {
+-			util_create_path(udev, filename);
+-			mkdir(filename, 0755);
+-		}
+-		inotify_add_watch(fd_inotify, filename,
+-				  IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
++	/* watch dynamic rules directory */
++	util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL);
++	if (stat(filename, &statbuf) != 0) {
++		util_create_path(udev, filename);
++		mkdir(filename, 0755);
+ 	}
++	inotify_add_watch(fd_inotify, filename,
++			  IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
+ 	udev_watch_restore(udev);
+ 
+ 	/* block and listen to all signals on signalfd */
diff --git a/pkgs/os-specific/linux/udisks/default.nix b/pkgs/os-specific/linux/udisks/default.nix
new file mode 100644
index 0000000000000..17482f698999d
--- /dev/null
+++ b/pkgs/os-specific/linux/udisks/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, pkgconfig, sg3_utils, udev, glib, dbus, dbus_glib
+, polkit, parted, lvm2, libatasmart, intltool, libuuid, mdadm
+, libxslt, docbook_xsl, utillinux, automake, autoconf }:
+
+stdenv.mkDerivation rec {
+  name = "udisks-1.0.3";
+
+  src = fetchurl {
+    url = "http://hal.freedesktop.org/releases/${name}.tar.gz";
+    sha256 = "0jwavs2ag0cv46517j17943s16a8fw2lqk4k3cljgivh5aswwnyr";
+  };
+
+  # Move 80-udisks.rules manually to make the patch smaller
+  prePatch = "mv -v data/80-udisks.rules{,.in}";
+
+  # Not written a patch that can be accepted upstream yet
+  postPatch = "sed -e 's@/sbin/mdadm@${mdadm}&@' -i data/80-udisks.rules.in";
+
+  patches = [ ./purity.patch ];
+
+
+  buildInputs =
+    [ sg3_utils udev glib dbus dbus_glib polkit parted
+      lvm2 libatasmart intltool libuuid libxslt docbook_xsl
+    ];
+
+  buildNativeInputs = [ automake autoconf pkgconfig ];
+
+  configureFlags = "--localstatedir=/var";
+
+  preConfigure =
+    ''
+      # Ensure that udisks can find the necessary programs.
+      substituteInPlace src/main.c --replace \
+        "/sbin:/bin:/usr/sbin:/usr/bin" \
+        "${utillinux}/bin:${mdadm}/sbin:/var/run/current-system/sw/bin:/var/run/current-system/sw/sbin"
+
+      automake
+    '';
+
+  meta = {
+    homepage = http://www.freedesktop.org/wiki/Software/udisks;
+    description = "A daemon and command-line utility for querying and manipulating storage devices";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/os-specific/linux/udisks/purity.patch b/pkgs/os-specific/linux/udisks/purity.patch
new file mode 100644
index 0000000000000..1896c757557a8
--- /dev/null
+++ b/pkgs/os-specific/linux/udisks/purity.patch
@@ -0,0 +1,74 @@
+diff --git a/data/80-udisks.rules.in b/data/80-udisks.rules.in
+index 6720394..60b67ed 100644
+--- a/data/80-udisks.rules.in
++++ b/data/80-udisks.rules.in
+@@ -23,7 +23,7 @@ LABEL="ata_port_cardbus_end"
+ #  this is the case we can trigger a 'change' on the sas_expander device
+ #  when the bsg device appears)
+ #
+-SUBSYSTEM=="sas_expander", ACTION=="add|change", IMPORT{program}="udisks-probe-sas-expander /sys/%p"
++SUBSYSTEM=="sas_expander", ACTION=="add|change", IMPORT{program}="@slashlibdir@/udev/udisks-probe-sas-expander /sys/%p"
+ 
+ ##############################################################################################################
+ 
+@@ -54,7 +54,7 @@ ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1", GOTO="udisks_end"
+ # import UDISKS_DM_* and UDISKS_LVM2_* properties - the long-term plan is to make the lvm2 and
+ # device-mapper packages provide this information
+ #
+-KERNEL=="dm-*", IMPORT{program}="udisks-dm-export %M %m"
++KERNEL=="dm-*", IMPORT{program}="@slashlibdir@/udev/udisks-dm-export %M %m"
+ 
+ # Make udevd synthesize a 'change' uevent when last opener of a rw-fd closes the fd - this
+ # should be part of the device-mapper rules
+@@ -63,7 +63,7 @@ KERNEL=="dm-*", OPTIONS+="watch"
+ ##############################################################################################################
+ # Probe LVM2 Physical Volumes - this will eventually be part of the LVM2 package
+ 
+-ENV{ID_FS_TYPE}=="LVM2_member", TEST=="/lib/udev/udisks-lvm-pv-export", IMPORT{program}="udisks-lvm-pv-export $env{ID_FS_UUID}"
++ENV{ID_FS_TYPE}=="LVM2_member", TEST=="@slashlibdir@/udev/udisks-lvm-pv-export", IMPORT{program}="@slashlibdir@/udev/udisks-lvm-pv-export $env{ID_FS_UUID}"
+ 
+ ##############################################################################################################
+ 
+@@ -85,7 +85,7 @@ KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="", GOTO="probe_parttable_e
+ 
+ # scan for partition tables both on whole-disk and partitions
+ #
+-IMPORT{program}="udisks-part-id $tempnode"
++IMPORT{program}="@slashlibdir@/udev/udisks-part-id $tempnode"
+ 
+ LABEL="probe_parttable_end"
+ 
+@@ -109,13 +109,13 @@ LABEL="md_end"
+ #
+ 
+ # USB ATA enclosures with a SAT layer
+-KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="usb", ENV{DEVTYPE}=="disk", IMPORT{program}="udisks-probe-ata-smart $tempnode"
++KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="usb", ENV{DEVTYPE}=="disk", IMPORT{program}="@slashlibdir@/udev/udisks-probe-ata-smart $tempnode"
+ 
+ # ATA disks driven by libata
+-KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="ata", ENV{DEVTYPE}=="disk", IMPORT{program}="udisks-probe-ata-smart $tempnode"
++KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="ata", ENV{DEVTYPE}=="disk", IMPORT{program}="@slashlibdir@/udev/udisks-probe-ata-smart $tempnode"
+ 
+ # ATA disks connected via SAS (not driven by libata)
+-KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="scsi", ENV{DEVTYPE}=="disk", ENV{ID_VENDOR}=="ATA", IMPORT{program}="udisks-probe-ata-smart $tempnode"
++KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="scsi", ENV{DEVTYPE}=="disk", ENV{ID_VENDOR}=="ATA", IMPORT{program}="@slashlibdir@/udev/udisks-probe-ata-smart $tempnode"
+ 
+ 
+ # Example rule for tagging a device with a specific media type. Where and
+diff --git a/data/Makefile.am b/data/Makefile.am
+index ca6d8ac..ed9faa3 100644
+--- a/data/Makefile.am
++++ b/data/Makefile.am
+@@ -25,7 +25,11 @@ $(dbusconf_DATA): $(dbusconf_in_files) Makefile
+ 	cp $< $@
+ 
+ udevrulesdir = $(slashlibdir)/udev/rules.d
+-udevrules_DATA = 80-udisks.rules
++udevrules_in_files = 80-udisks.rules.in
++udevrules_DATA =  $(udevrules_in_files:.rules.in=.rules)
++
++$(udevrules_DATA): $(udevrules_in_files) Makefile
++	@sed -e "s|\@slashlibdir\@|$(slashlibdir)|g" $< > $@
+ 
+ pkgconfigdir = $(datadir)/pkgconfig
+ pkgconfig_DATA = udisks.pc
diff --git a/pkgs/os-specific/linux/upower/default.nix b/pkgs/os-specific/linux/upower/default.nix
new file mode 100644
index 0000000000000..b0feb09cb86aa
--- /dev/null
+++ b/pkgs/os-specific/linux/upower/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, xz, pkgconfig, glib, dbus, dbus_glib, polkit
+, intltool, libxslt, docbook_xsl, udev, libusb1, pmutils }:
+
+assert stdenv.isLinux;
+
+stdenv.mkDerivation rec {
+  name = "upower-0.9.12";
+
+  src = fetchurl {
+    url = "http://upower.freedesktop.org/releases/${name}.tar.xz";
+    sha256 = "1c2b2f74vxx1y7vkwbrx5z4j5pdgvsw00l6cldvy7a4k7hrbprq6";
+  };
+
+  buildInputs = [ dbus_glib polkit intltool libxslt docbook_xsl udev libusb1 ];
+
+  buildNativeInputs = [ xz pkgconfig ];
+
+  configureFlags = "--with-backend=linux --localstatedir=/var";
+
+  preConfigure =
+    ''
+      substituteInPlace src/linux/up-backend.c \
+        --replace /usr/bin/pm- ${pmutils}/bin/pm- \
+        --replace /usr/sbin/pm- ${pmutils}/sbin/pm-
+    '';
+
+  installFlags = "localstatedir=$(TMPDIR)/var";
+
+  meta = {
+    homepage = http://upower.freedesktop.org/;
+    description = "A D-Bus service for power management";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/os-specific/linux/v4l-utils/default.nix b/pkgs/os-specific/linux/v4l-utils/default.nix
new file mode 100644
index 0000000000000..d20821e137c3f
--- /dev/null
+++ b/pkgs/os-specific/linux/v4l-utils/default.nix
@@ -0,0 +1,50 @@
+x@{builderDefsPackage
+  , libv4l, libjpeg, qt4
+  , ...}:
+builderDefsPackage
+(a :  
+let 
+  helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++ 
+    [];
+
+  buildInputs = map (n: builtins.getAttr n x)
+    (builtins.attrNames (builtins.removeAttrs x helperArgNames));
+  sourceInfo = rec {
+    baseName="v4l-utils";
+    version="0.8.5";
+    name="${baseName}-${version}";
+    url="http://www.linuxtv.org/downloads/v4l-utils/${name}.tar.bz2";
+    hash="0k2rkra8lyimj6bwm8khq6xrhjdy67d09blxa6brnj7kpa7q81f2";
+  };
+in
+rec {
+  src = a.fetchurl {
+    url = sourceInfo.url;
+    sha256 = sourceInfo.hash;
+  };
+
+  inherit (sourceInfo) name version;
+  inherit buildInputs;
+
+  /* doConfigure should be removed if not needed */
+  phaseNames = ["doUnpack" "doMakeInstall"];
+
+  makeFlags = [''PREFIX="" DESTDIR="$out"''];
+      
+  meta = {
+    description = "Video-4-Linux utilities";
+    maintainers = with a.lib.maintainers;
+    [
+      raskin
+    ];
+    platforms = with a.lib.platforms;
+      linux;
+    license = a.lib.licenses.gpl2;
+  };
+  passthru = {
+    updateInfo = {
+      downloadPage = "http://www.linuxtv.org/downloads/v4l-utils/";
+    };
+  };
+}) x
+
diff --git a/pkgs/os-specific/linux/xf86-input-multitouch/default.nix b/pkgs/os-specific/linux/xf86-input-multitouch/default.nix
new file mode 100644
index 0000000000000..b8f88216dfa5a
--- /dev/null
+++ b/pkgs/os-specific/linux/xf86-input-multitouch/default.nix
@@ -0,0 +1,53 @@
+{ stdenv
+, fetchgit
+, mtdev
+, xorgserver
+, xproto
+, pixman
+, xextproto
+, inputproto
+, randrproto
+, libpciaccess
+}:
+
+stdenv.mkDerivation {
+  name = "xf86-input-multitouch-20110312";
+
+  src = fetchgit {
+    url = http://bitmath.org/git/multitouch.git;
+    rev = "4d87c041f6a232aa30528d70d4b9946d1824b4ed";
+    sha256 = "de705e34bc75654139dfcbedfe43a3d182d140b198fcd57ab190d549471305ca";
+  };
+
+  # Configuration from http://bitmath.org/code/multitouch/
+  confFile = ''
+    Section "InputClass"
+        MatchIsTouchpad "true"
+        Identifier "Multitouch Touchpad"
+        Driver "multitouch"
+    EndSection
+  '';
+
+  buildInputs = [ mtdev xproto xextproto inputproto libpciaccess randrproto ];
+
+  buildPhase = ''
+    make INCLUDE="$NIX_CFLAGS_COMPILE -I${xorgserver}/include/xorg -I${pixman}/include/pixman-1 -Iinclude"
+  '';
+
+  installPhase = ''
+    make DESTDIR="$out" LIBDIR="lib" install
+    ensureDir $out/include/xorg
+    echo -n "$confFile" > $out/include/xorg/10-multitouch.conf
+  '';
+
+  meta = {
+    homepage = http://bitmath.org/code/multitouch/;
+
+    description = "Brings multitouch gestures to the Linux desktop";
+
+    license = "gplv2";
+
+    maintainers = [ stdenv.lib.maintainers.shlevy ];
+  };
+}
+
diff --git a/pkgs/os-specific/linux/xf86-input-wacom/10-wacom.rules b/pkgs/os-specific/linux/xf86-input-wacom/10-wacom.rules
deleted file mode 100644
index 260788c4538d6..0000000000000
--- a/pkgs/os-specific/linux/xf86-input-wacom/10-wacom.rules
+++ /dev/null
@@ -1,16 +0,0 @@
-# From http://linuxwacom.sourceforge.net/index.php/howto/newwacom
-# udev rules for wacom tablets.
-
-KERNEL!="event[0-9]*", GOTO="wacom_end"
-# Multiple interface support for stylus and touch devices.
-DRIVERS=="wacom", ATTRS{bInterfaceNumber}=="00", ENV{WACOM_TYPE}="stylus"
-DRIVERS=="wacom", ATTRS{bInterfaceNumber}=="01", ENV{WACOM_TYPE}="touch"
-# Convenience links for the common case of a single tablet. We could do just this:
-#ATTRS{idVendor}=="056a", SYMLINK+="input/wacom-$env{WACOM_TYPE}"
-# but for legacy reasons, we keep the input/wacom link as the generic stylus device.
-ATTRS{idVendor}=="056a", ENV{WACOM_TYPE}!="touch", SYMLINK+="input/wacom"
-ATTRS{idVendor}=="056a", ENV{WACOM_TYPE}=="touch", SYMLINK+="input/wacom-touch"
-# Check and repossess the device if a module other than the wacom one
-# is already bound to it.
-ATTRS{idVendor}=="056a", ACTION=="add", RUN+="check_driver wacom $devpath $env{ID_BUS}"
-LABEL="wacom_end"
diff --git a/pkgs/os-specific/linux/xf86-input-wacom/default.nix b/pkgs/os-specific/linux/xf86-input-wacom/default.nix
index 1102b2ebe40a8..9cc25174c51fb 100644
--- a/pkgs/os-specific/linux/xf86-input-wacom/default.nix
+++ b/pkgs/os-specific/linux/xf86-input-wacom/default.nix
@@ -1,18 +1,17 @@
-{ stdenv, fetchurl, 
-  file, inputproto, libX11, libXext, libXi, libXrandr, libXrender,
-  ncurses, pkgconfig, randrproto, xorgserver, xproto }:
+{ stdenv, fetchurl
+, file, inputproto, libX11, libXext, libXi, libXrandr, libXrender
+, ncurses, pkgconfig, randrproto, xorgserver, xproto, udev }:
 
 stdenv.mkDerivation rec {
-  name = "xf86-input-wacom";
-  version = "0.10.10";
+  name = "xf86-input-wacom-0.11.1";
 
   src = fetchurl {
-    url = "mirror://sourceforge/linuxwacom/${name}-${version}.tar.bz2";
-    sha256 = "03yggp2ww64va6gmasl0gy0rbfcyb1zlj9kapp9kvhk2j4458fdr";
+    url = "mirror://sourceforge/linuxwacom/${name}.tar.bz2";
+    sha256 = "1jmnrkf89a3jjbpn17gyndlv9lqc0n7qwyi22hraxypq213gjclx";
   };
 
-  buildInputs = [ file inputproto libX11 libXext libXi libXrandr libXrender
-    ncurses pkgconfig randrproto xorgserver xproto ];
+  buildInputs = [ inputproto libX11 libXext libXi libXrandr libXrender
+    ncurses pkgconfig randrproto xorgserver xproto udev ];
 
   preConfigure = ''
     ensureDir $out/share/X11/xorg.conf.d
@@ -20,12 +19,6 @@ stdenv.mkDerivation rec {
     --with-sdkdir=$out/include/xorg --with-xorg-conf-dir=$out/share/X11/xorg.conf.d"
   '';
 
-  postInstall =
-    ''
-      ensureDir $out/lib/udev/rules.d
-      cp ${./10-wacom.rules} $out/lib/udev/rules.d/10-wacom.rules
-    '';
-
   meta = with stdenv.lib; {
     maintainers = [ maintainers.goibhniu maintainers.urkud ];
     description = "Wacom digitizer driver for X11";