summary refs log tree commit diff
diff options
context:
space:
mode:
authorJack Cummings <jack@mudshark.org>2012-10-05 09:11:25 -0700
committerJack Cummings <jack@mudshark.org>2012-10-05 09:11:25 -0700
commite7f3ff803e15e7a65e4bcc0dec300e3b02233cfd (patch)
tree00a9f12ddf1c0a23175f19b18d95ceec06902ca1
parentccad09d3b9b80b41fd79b673ebede73444a9829c (diff)
downloadnixpkgs-e7f3ff803e15e7a65e4bcc0dec300e3b02233cfd.tar
nixpkgs-e7f3ff803e15e7a65e4bcc0dec300e3b02233cfd.tar.gz
nixpkgs-e7f3ff803e15e7a65e4bcc0dec300e3b02233cfd.tar.bz2
nixpkgs-e7f3ff803e15e7a65e4bcc0dec300e3b02233cfd.tar.lz
nixpkgs-e7f3ff803e15e7a65e4bcc0dec300e3b02233cfd.tar.xz
nixpkgs-e7f3ff803e15e7a65e4bcc0dec300e3b02233cfd.tar.zst
nixpkgs-e7f3ff803e15e7a65e4bcc0dec300e3b02233cfd.zip
- zfs 0.6.0-rc11, spl 0.6.0-rc11
-rw-r--r--pkgs/lib/licenses.nix6
-rw-r--r--pkgs/os-specific/linux/spl/default.nix39
-rw-r--r--pkgs/os-specific/linux/spl/install_prefix.patch19
-rw-r--r--pkgs/os-specific/linux/spl/install_prefix_2.patch32
-rw-r--r--pkgs/os-specific/linux/spl/module_prefix.patch33
-rw-r--r--pkgs/os-specific/linux/spl/spl-0.6.0.nix24
-rw-r--r--pkgs/os-specific/linux/zfs/default.nix34
-rw-r--r--pkgs/os-specific/linux/zfs/kerneldir_path.patch140
-rw-r--r--pkgs/os-specific/linux/zfs/module_perm_prefix.patch70
-rw-r--r--pkgs/os-specific/linux/zfs/mount_zfs_prefix.patch24
-rw-r--r--pkgs/os-specific/linux/zfs/no_absolute_paths_to_coreutils.patch25
-rw-r--r--pkgs/os-specific/linux/zfs/zfs-0.6.0.nix23
-rw-r--r--pkgs/top-level/all-packages.nix4
13 files changed, 473 insertions, 0 deletions
diff --git a/pkgs/lib/licenses.nix b/pkgs/lib/licenses.nix
index 87f9298706e..e1743bddf69 100644
--- a/pkgs/lib/licenses.nix
+++ b/pkgs/lib/licenses.nix
@@ -34,6 +34,12 @@
     url = https://fedoraproject.org/wiki/Licensing/BSD;
   };
 
+  cddl = {
+    shortName = "CDDL";
+    fullName = "Common Development Distribution License ";
+    url = http://www.opensolaris.org/os/licensing/cddllicense.txt;
+  };
+
   cpl10 = {
     shortName = "CPL 1.0";
     fullName = "Common Public License version 1.0";
diff --git a/pkgs/os-specific/linux/spl/default.nix b/pkgs/os-specific/linux/spl/default.nix
new file mode 100644
index 00000000000..96565fffa0e
--- /dev/null
+++ b/pkgs/os-specific/linux/spl/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchurl, kernel, perl, autoconf, automake, libtool, coreutils, gawk }:
+
+stdenv.mkDerivation {
+  name = "spl-0.6.0-rc11";
+  src = fetchurl {
+    url = http://github.com/downloads/zfsonlinux/spl/spl-0.6.0-rc11.tar.gz;
+    sha256 = "0brsrr9hvzlpx7a26nn8rw9k2kh9s75hmxp6h087hi64hzxysf8g";
+  };
+
+  patches = [ ./install_prefix.patch ./install_prefix_2.patch ./module_prefix.patch ];
+
+  buildInputs = [ perl kernel autoconf automake libtool ];
+
+  NIX_CFLAGS_COMPILE = "-I${kernel}/lib/modules/${kernel.modDirVersion}/build/include/generated";
+
+  preConfigure = ''
+    ./autogen.sh
+
+    substituteInPlace ./module/spl/spl-generic.c --replace /usr/bin/hostid   hostid
+    substituteInPlace ./module/spl/spl-module.c  --replace /bin/mknod        mknod 
+
+    substituteInPlace ./module/spl/spl-generic.c --replace "PATH=/sbin:/usr/sbin:/bin:/usr/bin" "PATH=${coreutils}:${gawk}:/bin"
+    substituteInPlace ./module/spl/spl-module.c  --replace "PATH=/sbin:/usr/sbin:/bin:/usr/bin" "PATH=${coreutils}:/bin"
+    substituteInPlace ./module/splat/splat-vnode.c --replace "PATH=/sbin:/usr/sbin:/bin:/usr/bin" "PATH=${coreutils}:/bin"
+  '';
+
+  configureFlags = ''
+     --with-linux=${kernel}/lib/modules/${kernel.version}/build
+     --with-linux-obj=${kernel}/lib/modules/${kernel.version}/build
+  '';
+
+  meta = {
+    description = "Kernel module driver for solaris porting layer (needed by in-kernel zfs)";
+    homepage = http://zfsonlinux.org/;
+    platforms = stdenv.lib.platforms.linux;
+    license = stdenv.lib.licenses.cddl;
+    maintainers = with stdenv.lib.maintainers; [ jcumming ];
+  };
+}
diff --git a/pkgs/os-specific/linux/spl/install_prefix.patch b/pkgs/os-specific/linux/spl/install_prefix.patch
new file mode 100644
index 00000000000..9a7393b7170
--- /dev/null
+++ b/pkgs/os-specific/linux/spl/install_prefix.patch
@@ -0,0 +1,19 @@
+*** spl-0.6.0-rc10/Makefile.am.old	Fri Aug 17 14:49:16 2012
+--- spl-0.6.0-rc10/Makefile.am	Fri Aug 17 14:51:06 2012
+***************
+*** 32,38 ****
+  if CONFIG_KERNEL
+  install-data-local:
+  	release=$(SPL_META_VERSION)-$(SPL_META_RELEASE); \
+! 	instdest=$(DESTDIR)/usr/src/spl-$$release/$(LINUX_VERSION); \
+  	for instfile in $(noinst_HEADERS) module/$(LINUX_SYMBOLS); do \
+  		$(INSTALL) -D $$instfile $$instdest/$$instfile; \
+  	done
+--- 32,38 ----
+  if CONFIG_KERNEL
+  install-data-local:
+  	release=$(SPL_META_VERSION)-$(SPL_META_RELEASE); \
+! 	instdest=$(DESTDIR)/@libexecdir@/spl/$(LINUX_VERSION); \
+  	for instfile in $(noinst_HEADERS) module/$(LINUX_SYMBOLS); do \
+  		$(INSTALL) -D $$instfile $$instdest/$$instfile; \
+  	done
diff --git a/pkgs/os-specific/linux/spl/install_prefix_2.patch b/pkgs/os-specific/linux/spl/install_prefix_2.patch
new file mode 100644
index 00000000000..6068ad1d69c
--- /dev/null
+++ b/pkgs/os-specific/linux/spl/install_prefix_2.patch
@@ -0,0 +1,32 @@
+*** git-export/include/Makefile.am	Tue Mar  6 00:05:28 2012
+--- git-export/include/Makefile.am.new	Tue Mar  6 00:04:46 2012
+***************
+*** 16,22 ****
+  
+  install-data-local:
+  	release=$(SPL_META_VERSION)-$(SPL_META_RELEASE); \
+! 	instdest=$(DESTDIR)/usr/src/spl-$$release/$(LINUX_VERSION); \
+  	instfiles=`find . -name '*.h'`; \
+          for instfile in $$instfiles; do \
+  		$(INSTALL) -D $$instfile $$instdest/$$instfile; \
+--- 16,22 ----
+  
+  install-data-local:
+  	release=$(SPL_META_VERSION)-$(SPL_META_RELEASE); \
+! 	instdest=$(DESTDIR)/@libexecdir@/spl/$(LINUX_VERSION); \
+  	instfiles=`find . -name '*.h'`; \
+          for instfile in $$instfiles; do \
+  		$(INSTALL) -D $$instfile $$instdest/$$instfile; \
+***************
+*** 24,28 ****
+  
+  uninstall-local:
+  	release=$(SPL_META_VERSION)-$(SPL_META_RELEASE); \
+! 	instdest=$(DESTDIR)/usr/src/spl-$$release/$(LINUX_VERSION); \
+  	$(RM) -R $$instdest
+--- 24,28 ----
+  
+  uninstall-local:
+  	release=$(SPL_META_VERSION)-$(SPL_META_RELEASE); \
+! 	instdest=$(DESTDIR)/@libexecdir@/spl/$(LINUX_VERSION); \
+  	$(RM) -R $$instdest
diff --git a/pkgs/os-specific/linux/spl/module_prefix.patch b/pkgs/os-specific/linux/spl/module_prefix.patch
new file mode 100644
index 00000000000..dd40711ccdb
--- /dev/null
+++ b/pkgs/os-specific/linux/spl/module_prefix.patch
@@ -0,0 +1,33 @@
+*** git-export/module/Makefile.in	Wed Dec 31 16:00:01 1969
+--- git-export/module/Makefile.in.new	Sat Jan 28 21:42:06 2012
+***************
+*** 17,30 ****
+  modules_install:
+  	@# Install the kernel modules
+  	$(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` \
+! 		INSTALL_MOD_PATH=$(DESTDIR) \
+  		INSTALL_MOD_DIR=addon/spl $@
+  	@# Remove extraneous build products when packaging
+! 	if [ -n "$(DESTDIR)" ]; then \
+! 		find $(DESTDIR)/lib/modules/@LINUX_VERSION@ \
+  			-name 'modules.*' | xargs $(RM); \
+  	fi
+! 	sysmap=$(DESTDIR)/boot/System.map-@LINUX_VERSION@; \
+  	if [ -f $$sysmap ]; then \
+  		depmod -ae -F $$sysmap @LINUX_VERSION@; \
+  	fi
+--- 17,30 ----
+  modules_install:
+  	@# Install the kernel modules
+  	$(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` \
+! 		INSTALL_MOD_PATH=@prefix@ \
+  		INSTALL_MOD_DIR=addon/spl $@
+  	@# Remove extraneous build products when packaging
+! 	if [ -n "@prefix@" ]; then \
+! 		find @prefix@/lib/modules/@LINUX_VERSION@ \
+  			-name 'modules.*' | xargs $(RM); \
+  	fi
+! 	sysmap=@prefix@/boot/System.map-@LINUX_VERSION@; \
+  	if [ -f $$sysmap ]; then \
+  		depmod -ae -F $$sysmap @LINUX_VERSION@; \
+  	fi
diff --git a/pkgs/os-specific/linux/spl/spl-0.6.0.nix b/pkgs/os-specific/linux/spl/spl-0.6.0.nix
new file mode 100644
index 00000000000..c174daad26b
--- /dev/null
+++ b/pkgs/os-specific/linux/spl/spl-0.6.0.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchgit, kernel, linuxHeaders, perl }:
+
+stdenv.mkDerivation {
+  name = "spl-0.6.0-rc4";
+  src = fetchgit {
+    url = git://github.com/behlendorf/spl.git;
+    rev = "dde6b7b137f56894a457";
+    sha256 = "c402517a647de0c22a69588219aa214f96d1cf9d2f8751b99c5a2795898c726b";
+  };
+
+  patches = [ ./install_prefix.patch ./module_prefix.patch ];
+
+  buildInputs = [ perl kernel linuxHeaders ];
+
+  configureFlags = [ "--with-linux=${kernel}/lib/modules/${kernel.version}/build" 
+                     "--with-linux-obj=${kernel}/lib/modules/${kernel.version}/build" ];
+
+  meta = {
+    description = "Kernel module driver for solaris porting layer (needed by in-kernel zfs)";
+    homepage = http://zfsonlinux.org/;
+    license = "CDDL";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/os-specific/linux/zfs/default.nix b/pkgs/os-specific/linux/zfs/default.nix
new file mode 100644
index 00000000000..43e7b2fd95d
--- /dev/null
+++ b/pkgs/os-specific/linux/zfs/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, kernel, spl, perl, zlib, libuuid, coreutils, utillinux }:
+
+stdenv.mkDerivation {
+  name = "zfs-0.6.0-rc11";
+  src = fetchurl {
+    url = http://github.com/downloads/zfsonlinux/zfs/zfs-0.6.0-rc11.tar.gz;
+    sha256 = "0wx0srn2k31j9xdk3nvk7l847r0diyb7ph6hd006ax9l5p9zj0a7";
+  };
+
+  patches = [ ./module_perm_prefix.patch ./mount_zfs_prefix.patch ./kerneldir_path.patch ./no_absolute_paths_to_coreutils.patch ];
+
+  buildInputs = [ kernel spl perl zlib libuuid coreutils ];
+
+  NIX_CFLAGS_COMPILE = "-I${kernel}/lib/modules/${kernel.modDirVersion}/build/include/generated";
+
+  preConfigure = ''
+    substituteInPlace ./module/zfs/zfs_ctldir.c  --replace "umount -t zfs"   "${utillinux}/bin/umount -t zfs"
+    substituteInPlace ./module/zfs/zfs_ctldir.c  --replace "mount -t zfs"    "${utillinux}/bin/mount -t zfs"
+  '';
+
+  configureFlags = ''
+    --with-linux=${kernel}/lib/modules/${kernel.version}/build 
+    --with-linux-obj=${kernel}/lib/modules/${kernel.version}/build 
+    --with-spl=${spl}/libexec/spl/${kernel.version}
+  '';
+
+  meta = {
+    description = "Native ZFS for Linux";
+    homepage = http://zfsonlinux.org/;
+    platforms = stdenv.lib.platforms.linux;
+    license = stdenv.lib.licenses.cddl;
+    maintainers = with stdenv.lib.maintainers; [ jcumming ];
+  };
+}
diff --git a/pkgs/os-specific/linux/zfs/kerneldir_path.patch b/pkgs/os-specific/linux/zfs/kerneldir_path.patch
new file mode 100644
index 00000000000..7deda946821
--- /dev/null
+++ b/pkgs/os-specific/linux/zfs/kerneldir_path.patch
@@ -0,0 +1,140 @@
+diff -rc zfs-0.6.0-rc10.old/Makefile.in zfs-0.6.0-rc10/Makefile.in
+*** zfs-0.6.0-rc10.old/Makefile.in	Tue Aug 14 12:35:34 2012
+--- zfs-0.6.0-rc10/Makefile.in	Fri Aug 17 15:21:18 2012
+***************
+*** 1121,1127 ****
+  
+  @CONFIG_KERNEL_TRUE@install-data-local:
+  @CONFIG_KERNEL_TRUE@	release=$(ZFS_META_VERSION)-$(ZFS_META_RELEASE); \
+! @CONFIG_KERNEL_TRUE@	instdest=$(DESTDIR)/usr/src/zfs-$$release/$(LINUX_VERSION); \
+  @CONFIG_KERNEL_TRUE@	for instfile in $(noinst_HEADERS) module/$(LINUX_SYMBOLS); do \
+  @CONFIG_KERNEL_TRUE@		$(INSTALL) -D $$instfile $$instdest/$$instfile; \
+  @CONFIG_KERNEL_TRUE@	done
+--- 1121,1127 ----
+  
+  @CONFIG_KERNEL_TRUE@install-data-local:
+  @CONFIG_KERNEL_TRUE@	release=$(ZFS_META_VERSION)-$(ZFS_META_RELEASE); \
+! @CONFIG_KERNEL_TRUE@	instdest=$(DESTDIR)/@libexecdir@/zfs/$(LINUX_VERSION); \
+  @CONFIG_KERNEL_TRUE@	for instfile in $(noinst_HEADERS) module/$(LINUX_SYMBOLS); do \
+  @CONFIG_KERNEL_TRUE@		$(INSTALL) -D $$instfile $$instdest/$$instfile; \
+  @CONFIG_KERNEL_TRUE@	done
+diff -rc zfs-0.6.0-rc10.old/include/Makefile.in zfs-0.6.0-rc10/include/Makefile.in
+*** zfs-0.6.0-rc10.old/include/Makefile.in	Tue Aug 14 12:35:32 2012
+--- zfs-0.6.0-rc10/include/Makefile.in	Fri Aug 17 15:20:50 2012
+***************
+*** 402,408 ****
+  EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
+  @CONFIG_USER_TRUE@libzfsdir = $(includedir)/libzfs
+  @CONFIG_USER_TRUE@libzfs_HEADERS = $(COMMON_H) $(USER_H)
+! @CONFIG_KERNEL_TRUE@kerneldir = /usr/src/zfs-$(ZFS_META_VERSION)-$(ZFS_META_RELEASE)/$(LINUX_VERSION)
+  @CONFIG_KERNEL_TRUE@kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
+  all: all-recursive
+  
+--- 402,408 ----
+  EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
+  @CONFIG_USER_TRUE@libzfsdir = $(includedir)/libzfs
+  @CONFIG_USER_TRUE@libzfs_HEADERS = $(COMMON_H) $(USER_H)
+! @CONFIG_KERNEL_TRUE@kerneldir = $(DESTDIR)/@libexecdir@/zfs/$(LINUX_VERSION)
+  @CONFIG_KERNEL_TRUE@kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
+  all: all-recursive
+  
+diff -rc zfs-0.6.0-rc10.old/include/linux/Makefile.in zfs-0.6.0-rc10/include/linux/Makefile.in
+*** zfs-0.6.0-rc10.old/include/linux/Makefile.in	Tue Aug 14 12:35:32 2012
+--- zfs-0.6.0-rc10/include/linux/Makefile.in	Fri Aug 17 15:20:53 2012
+***************
+*** 337,343 ****
+  EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
+  @CONFIG_USER_TRUE@libzfsdir = $(includedir)/libzfs/linux
+  @CONFIG_USER_TRUE@libzfs_HEADERS = $(COMMON_H) $(USER_H)
+! @CONFIG_KERNEL_TRUE@kerneldir = /usr/src/zfs-$(ZFS_META_VERSION)-$(ZFS_META_RELEASE)/$(LINUX_VERSION)/linux
+  @CONFIG_KERNEL_TRUE@kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
+  all: all-am
+  
+--- 337,343 ----
+  EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
+  @CONFIG_USER_TRUE@libzfsdir = $(includedir)/libzfs/linux
+  @CONFIG_USER_TRUE@libzfs_HEADERS = $(COMMON_H) $(USER_H)
+! @CONFIG_KERNEL_TRUE@kerneldir = $(DESTDIR)/@libexecdir@/zfs/$(LINUX_VERSION)/linux
+  @CONFIG_KERNEL_TRUE@kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
+  all: all-am
+  
+diff -rc zfs-0.6.0-rc10.old/include/sys/Makefile.in zfs-0.6.0-rc10/include/sys/Makefile.in
+*** zfs-0.6.0-rc10.old/include/sys/Makefile.in	Tue Aug 14 12:35:32 2012
+--- zfs-0.6.0-rc10/include/sys/Makefile.in	Fri Aug 17 15:20:57 2012
+***************
+*** 590,596 ****
+  EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
+  @CONFIG_USER_TRUE@libzfsdir = $(includedir)/libzfs/sys
+  @CONFIG_USER_TRUE@libzfs_HEADERS = $(COMMON_H) $(USER_H)
+! @CONFIG_KERNEL_TRUE@kerneldir = /usr/src/zfs-$(ZFS_META_VERSION)-$(ZFS_META_RELEASE)/$(LINUX_VERSION)/sys
+  @CONFIG_KERNEL_TRUE@kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
+  all: all-recursive
+  
+--- 590,596 ----
+  EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
+  @CONFIG_USER_TRUE@libzfsdir = $(includedir)/libzfs/sys
+  @CONFIG_USER_TRUE@libzfs_HEADERS = $(COMMON_H) $(USER_H)
+! @CONFIG_KERNEL_TRUE@kerneldir = $(DESTDIR)/@libexecdir@/zfs/$(LINUX_VERSION)/sys
+  @CONFIG_KERNEL_TRUE@kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
+  all: all-recursive
+  
+diff -rc zfs-0.6.0-rc10.old/include/sys/fm/Makefile.in zfs-0.6.0-rc10/include/sys/fm/Makefile.in
+*** zfs-0.6.0-rc10.old/include/sys/fm/Makefile.in	Tue Aug 14 12:35:32 2012
+--- zfs-0.6.0-rc10/include/sys/fm/Makefile.in	Fri Aug 17 15:21:00 2012
+***************
+*** 374,380 ****
+  EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
+  @CONFIG_USER_TRUE@libzfsdir = $(includedir)/libzfs/sys/fm
+  @CONFIG_USER_TRUE@libzfs_HEADERS = $(COMMON_H) $(USER_H)
+! @CONFIG_KERNEL_TRUE@kerneldir = /usr/src/zfs-$(ZFS_META_VERSION)-$(ZFS_META_RELEASE)/$(LINUX_VERSION)/sys/fm
+  @CONFIG_KERNEL_TRUE@kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
+  all: all-recursive
+  
+--- 374,380 ----
+  EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
+  @CONFIG_USER_TRUE@libzfsdir = $(includedir)/libzfs/sys/fm
+  @CONFIG_USER_TRUE@libzfs_HEADERS = $(COMMON_H) $(USER_H)
+! @CONFIG_KERNEL_TRUE@kerneldir = $(DESTDIR)/@libexecdir@/zfs/$(LINUX_VERSION)/sys/fm
+  @CONFIG_KERNEL_TRUE@kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
+  all: all-recursive
+  
+diff -rc zfs-0.6.0-rc10.old/include/sys/fm/fs/Makefile.in zfs-0.6.0-rc10/include/sys/fm/fs/Makefile.in
+*** zfs-0.6.0-rc10.old/include/sys/fm/fs/Makefile.in	Tue Aug 14 12:35:32 2012
+--- zfs-0.6.0-rc10/include/sys/fm/fs/Makefile.in	Fri Aug 17 15:21:03 2012
+***************
+*** 332,338 ****
+  EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
+  @CONFIG_USER_TRUE@libzfsdir = $(includedir)/libzfs/sys/fm/fs
+  @CONFIG_USER_TRUE@libzfs_HEADERS = $(COMMON_H) $(USER_H)
+! @CONFIG_KERNEL_TRUE@kerneldir = /usr/src/zfs-$(ZFS_META_VERSION)-$(ZFS_META_RELEASE)/$(LINUX_VERSION)/sys/fm/fs
+  @CONFIG_KERNEL_TRUE@kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
+  all: all-am
+  
+--- 332,338 ----
+  EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
+  @CONFIG_USER_TRUE@libzfsdir = $(includedir)/libzfs/sys/fm/fs
+  @CONFIG_USER_TRUE@libzfs_HEADERS = $(COMMON_H) $(USER_H)
+! @CONFIG_KERNEL_TRUE@kerneldir = $(DESTDIR)/@libexecdir@/zfs/$(LINUX_VERSION)/sys/fm/fs
+  @CONFIG_KERNEL_TRUE@kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
+  all: all-am
+  
+diff -rc zfs-0.6.0-rc10.old/include/sys/fs/Makefile.in zfs-0.6.0-rc10/include/sys/fs/Makefile.in
+*** zfs-0.6.0-rc10.old/include/sys/fs/Makefile.in	Tue Aug 14 12:35:32 2012
+--- zfs-0.6.0-rc10/include/sys/fs/Makefile.in	Fri Aug 17 15:21:06 2012
+***************
+*** 332,338 ****
+  EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
+  @CONFIG_USER_TRUE@libzfsdir = $(includedir)/libzfs/sys/fs
+  @CONFIG_USER_TRUE@libzfs_HEADERS = $(COMMON_H) $(USER_H)
+! @CONFIG_KERNEL_TRUE@kerneldir = /usr/src/zfs-$(ZFS_META_VERSION)-$(ZFS_META_RELEASE)/$(LINUX_VERSION)/sys/fs
+  @CONFIG_KERNEL_TRUE@kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
+  all: all-am
+  
+--- 332,338 ----
+  EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)
+  @CONFIG_USER_TRUE@libzfsdir = $(includedir)/libzfs/sys/fs
+  @CONFIG_USER_TRUE@libzfs_HEADERS = $(COMMON_H) $(USER_H)
+! @CONFIG_KERNEL_TRUE@kerneldir = $(DESTDIR)/@libexecdir@/zfs/$(LINUX_VERSION)/sys/fs
+  @CONFIG_KERNEL_TRUE@kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
+  all: all-am
+  
diff --git a/pkgs/os-specific/linux/zfs/module_perm_prefix.patch b/pkgs/os-specific/linux/zfs/module_perm_prefix.patch
new file mode 100644
index 00000000000..07cd04d1dde
--- /dev/null
+++ b/pkgs/os-specific/linux/zfs/module_perm_prefix.patch
@@ -0,0 +1,70 @@
+*** git-export/module/Makefile.in.orig	Wed Dec 31 16:00:01 1969
+--- git-export/module/Makefile.in	Tue Mar  6 00:23:07 2012
+***************
+*** 11,19 ****
+  	@# installed devel headers, or they may be in the module
+  	@# subdirectory when building against the spl source tree.
+  	@if [ -f @SPL_OBJ@/@SPL_SYMBOLS@ ]; then \
+! 		/bin/cp @SPL_OBJ@/@SPL_SYMBOLS@ .; \
+  	elif [ -f @SPL_OBJ@/module/@SPL_SYMBOLS@ ]; then \
+! 		/bin/cp @SPL_OBJ@/module/@SPL_SYMBOLS@ .; \
+  	else \
+  		echo -e "\n" \
+  		"*** Missing spl symbols ensure you have built the spl:\n" \
+--- 11,21 ----
+  	@# installed devel headers, or they may be in the module
+  	@# subdirectory when building against the spl source tree.
+  	@if [ -f @SPL_OBJ@/@SPL_SYMBOLS@ ]; then \
+! 		/bin/cp -f @SPL_OBJ@/@SPL_SYMBOLS@ .; \
+! 		chmod +w @SPL_SYMBOLS@ .; \
+  	elif [ -f @SPL_OBJ@/module/@SPL_SYMBOLS@ ]; then \
+! 		/bin/cp -f @SPL_OBJ@/module/@SPL_SYMBOLS@ .; \
+! 		chmod +w @SPL_SYMBOLS@ .; \
+  	else \
+  		echo -e "\n" \
+  		"*** Missing spl symbols ensure you have built the spl:\n" \
+***************
+*** 35,55 ****
+  modules_install:
+  	@# Install the kernel modules
+  	$(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` \
+! 		INSTALL_MOD_PATH=$(DESTDIR) \
+  		INSTALL_MOD_DIR=addon/zfs $@
+  	@# Remove extraneous build products when packaging
+! 	if [ -n "$(DESTDIR)" ]; then \
+! 		find $(DESTDIR)/lib/modules/@LINUX_VERSION@ \
+  			-name 'modules.*' | xargs $(RM); \
+  	fi
+! 	sysmap=$(DESTDIR)/boot/System.map-@LINUX_VERSION@; \
+  	if [ -f $$sysmap ]; then \
+  		depmod -ae -F $$sysmap @LINUX_VERSION@; \
+  	fi
+  
+  modules_uninstall:
+  	@# Uninstall the kernel modules
+! 	$(RM) -R $(DESTDIR)/lib/modules/@LINUX_VERSION@/addon/zfs
+  
+  distdir:
+  
+--- 37,57 ----
+  modules_install:
+  	@# Install the kernel modules
+  	$(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` \
+! 		INSTALL_MOD_PATH=@prefix@ \
+  		INSTALL_MOD_DIR=addon/zfs $@
+  	@# Remove extraneous build products when packaging
+! 	if [ -n "@prefix@" ]; then \
+! 		find @prefix@/lib/modules/@LINUX_VERSION@ \
+  			-name 'modules.*' | xargs $(RM); \
+  	fi
+! 	sysmap=@prefix@/boot/System.map-@LINUX_VERSION@; \
+  	if [ -f $$sysmap ]; then \
+  		depmod -ae -F $$sysmap @LINUX_VERSION@; \
+  	fi
+  
+  modules_uninstall:
+  	@# Uninstall the kernel modules
+! 	$(RM) -R @prefix@/lib/modules/@LINUX_VERSION@/addon/zfs
+  
+  distdir:
+  
diff --git a/pkgs/os-specific/linux/zfs/mount_zfs_prefix.patch b/pkgs/os-specific/linux/zfs/mount_zfs_prefix.patch
new file mode 100644
index 00000000000..94710c5c985
--- /dev/null
+++ b/pkgs/os-specific/linux/zfs/mount_zfs_prefix.patch
@@ -0,0 +1,24 @@
+*** zfs-0.6.0-rc4.old/cmd/mount_zfs/Makefile.in	Thu May  5 15:12:25 2011
+--- zfs-0.6.0-rc4/cmd/mount_zfs/Makefile.in	Fri Jun  3 16:42:41 2011
+***************
+*** 285,296 ****
+  prefix = @prefix@
+  program_transform_name = @program_transform_name@
+  psdir = @psdir@
+! 
+! #
+! # Ignore the prefix for the mount helper.  It must be installed in /sbin/
+! # because this path is hardcoded in the mount(8) for security reasons.
+! #
+! sbindir = /sbin
+  sharedstatedir = @sharedstatedir@
+  srcdir = @srcdir@
+  sysconfdir = @sysconfdir@
+--- 285,291 ----
+  prefix = @prefix@
+  program_transform_name = @program_transform_name@
+  psdir = @psdir@
+! sbindir = @sbindir@
+  sharedstatedir = @sharedstatedir@
+  srcdir = @srcdir@
+  sysconfdir = @sysconfdir@
diff --git a/pkgs/os-specific/linux/zfs/no_absolute_paths_to_coreutils.patch b/pkgs/os-specific/linux/zfs/no_absolute_paths_to_coreutils.patch
new file mode 100644
index 00000000000..e223e34c3a4
--- /dev/null
+++ b/pkgs/os-specific/linux/zfs/no_absolute_paths_to_coreutils.patch
@@ -0,0 +1,25 @@
+*** git-export/module/Makefile.in.old	Tue Mar  6 01:04:48 2012
+--- git-export/module/Makefile.in	Tue Mar  6 01:04:59 2012
+***************
+*** 11,20 ****
+  	@# installed devel headers, or they may be in the module
+  	@# subdirectory when building against the spl source tree.
+  	@if [ -f @SPL_OBJ@/@SPL_SYMBOLS@ ]; then \
+! 		/bin/cp -f @SPL_OBJ@/@SPL_SYMBOLS@ .; \
+  		chmod +w @SPL_SYMBOLS@ .; \
+  	elif [ -f @SPL_OBJ@/module/@SPL_SYMBOLS@ ]; then \
+! 		/bin/cp -f @SPL_OBJ@/module/@SPL_SYMBOLS@ .; \
+  		chmod +w @SPL_SYMBOLS@ .; \
+  	else \
+  		echo -e "\n" \
+--- 11,20 ----
+  	@# installed devel headers, or they may be in the module
+  	@# subdirectory when building against the spl source tree.
+  	@if [ -f @SPL_OBJ@/@SPL_SYMBOLS@ ]; then \
+! 		cp -f @SPL_OBJ@/@SPL_SYMBOLS@ .; \
+  		chmod +w @SPL_SYMBOLS@ .; \
+  	elif [ -f @SPL_OBJ@/module/@SPL_SYMBOLS@ ]; then \
+! 		cp -f @SPL_OBJ@/module/@SPL_SYMBOLS@ .; \
+  		chmod +w @SPL_SYMBOLS@ .; \
+  	else \
+  		echo -e "\n" \
diff --git a/pkgs/os-specific/linux/zfs/zfs-0.6.0.nix b/pkgs/os-specific/linux/zfs/zfs-0.6.0.nix
new file mode 100644
index 00000000000..1cc923f39d1
--- /dev/null
+++ b/pkgs/os-specific/linux/zfs/zfs-0.6.0.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchgit, kernel, linuxHeaders, spl, perl, zlib, libuuid }:
+
+stdenv.mkDerivation {
+  name = "zfs-0.6.0-rc4";
+  src = fetchgit {
+    url = git://github.com/behlendorf/zfs.git;
+    rev = "3613204cd7e3ab1ae658";
+    sha256 = "217ca162b1b0178dd2e3acc543d3c0cce3a7be7e884a9118ffa0a84d3cbc73f5";
+  };
+
+  patches = [ ./module_perm_prefix.patch ./mount_zfs_prefix.patch ./kerneldir_path.patch ];
+
+  buildInputs = [ kernel linuxHeaders spl perl zlib libuuid];
+
+  configureFlags = " --with-linux=${kernel}/lib/modules/${kernel.version}/build --with-linux-obj=${kernel}/lib/modules/${kernel.version}/build --with-spl=${spl}/libexec/spl-0.6.0/${kernel.version}";
+
+  meta = {
+    description = "Native ZFS for Linux";
+    homepage = http://zfsonlinux.org/;
+    license = "CDDL";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 0c0647c60f5..391ebadc6fa 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5964,6 +5964,8 @@ let
 
     perf = callPackage ../os-specific/linux/kernel/perf.nix { };
 
+    spl = callPackage ../os-specific/linux/spl/default.nix { };
+
     sysprof = callPackage ../development/tools/profiling/sysprof {
       inherit (gnome) libglade;
     };
@@ -5983,6 +5985,8 @@ let
     };
 
     virtualboxGuestAdditions = callPackage ../applications/virtualization/virtualbox/guest-additions { };
+
+    zfs = callPackage ../os-specific/linux/zfs/default.nix { };
   };
 
   # Build the kernel modules for the some of the kernels.