git.iko.soy/typeable/nixpkgs
on master help sign in
zfsUnstable: init at 2017-09-12
commit1ecf3e862f40fa87afdc7492282e48f4889f02ef authorJörg Thalheim <joerg@thalheim.io> dateWed 13 Sep 2017, 00:28 (9 years ago) parentf4dfa30
5 files changed+239−153
nixos/modules/rename.nix−1 nixos/modules/tasks/filesystems/zfs.nix+18−1 pkgs/os-specific/linux/spl/default.nix+52−39 pkgs/os-specific/linux/zfs/default.nix+155−104 pkgs/top-level/all-packages.nix+14−8
nixos/modules/rename.nix−1
@@ -192,7 +192,6 @@ with lib;
192192 "Set the option `services.xserver.displayManager.sddm.package' instead.")
193193 (mkRemovedOptionModule [ "fonts" "fontconfig" "forceAutohint" ] "")
194194 (mkRemovedOptionModule [ "fonts" "fontconfig" "renderMonoTTFAsBitmap" ] "")
195− (mkRemovedOptionModule [ "boot" "zfs" "enableUnstable" ] "0.7.0 is now the default")
196195
197196 # ZSH
198197 (mkRenamedOptionModule [ "programs" "zsh" "enableSyntaxHighlighting" ] [ "programs" "zsh" "syntaxHighlighting" "enable" ])
nixos/modules/tasks/filesystems/zfs.nix+18−1
@@ -24,7 +24,11 @@ let
2424
2525 kernel = config.boot.kernelPackages;
2626
27− packages = {
27+ packages = if config.boot.zfs.enableUnstable then {
28+ spl = kernel.splUnstable;
29+ zfs = kernel.zfsUnstable;
30+ zfsUser = pkgs.zfsUnstable;
31+ } else {
2832 spl = kernel.spl;
2933 zfs = kernel.zfs;
3034 zfsUser = pkgs.zfs;
@@ -58,6 +62,19 @@ in
5862
5963 options = {
6064 boot.zfs = {
65+ enableUnstable = mkOption {
66+ type = types.bool;
67+ default = false;
68+ description = ''
69+ Use the unstable zfs package. This might be an option, if the latest
70+ kernel is not yet supported by a published release of ZFS. Enabling
71+ this option will install a development version of ZFS on Linux. The
72+ version will have already passed an extensive test suite, but it is
73+ more likely to hit an undiscovered bug compared to running a released
74+ version of ZFS on Linux.
75+ '';
76+ };
77+
6178 extraPools = mkOption {
6279 type = types.listOf types.str;
6380 default = [];
pkgs/os-specific/linux/spl/default.nix+52−39
@@ -10,53 +10,66 @@ with stdenv.lib;
1010let
1111 buildKernel = any (n: n == configFile) [ "kernel" "all" ];
1212 buildUser = any (n: n == configFile) [ "user" "all" ];
13−in
14− assert any (n: n == configFile) [ "kernel" "user" "all" ];
15− assert buildKernel -> kernel != null;
16−stdenv.mkDerivation rec {
17− name = "spl-${configFile}-${version}${optionalString buildKernel "-${kernel.version}"}";
18− version = "0.7.1";
19−
20− src = fetchFromGitHub {
21− owner = "zfsonlinux";
22− repo = "spl";
23− rev = "spl-${version}";
24− sha256 = "0m8qhbdd8n40lbd91s30q4lrw8g169sha0410c8rwk2d5qfaxv9n";
25− };
13+ common = { version
14+ , sha256
15+ , rev ? "spl-${version}"
16+ } @ args : stdenv.mkDerivation rec {
17+ name = "spl-${configFile}-${version}${optionalString buildKernel "-${kernel.version}"}";
18+
19+ src = fetchFromGitHub {
20+ owner = "zfsonlinux";
21+ repo = "spl";
22+ inherit rev sha256;
23+ };
2624
27− patches = [ ./const.patch ./install_prefix.patch ];
25+ patches = [ ./const.patch ./install_prefix.patch ];
2826
29− nativeBuildInputs = [ autoreconfHook ];
27+ nativeBuildInputs = [ autoreconfHook ];
3028
31− hardeningDisable = [ "pic" ];
29+ hardeningDisable = [ "pic" ];
3230
33− preConfigure = ''
34− substituteInPlace ./module/spl/spl-generic.c --replace /usr/bin/hostid hostid
35− substituteInPlace ./module/spl/spl-generic.c --replace "PATH=/sbin:/usr/sbin:/bin:/usr/bin" "PATH=${coreutils}:${gawk}:/bin"
36− substituteInPlace ./module/splat/splat-vnode.c --replace "PATH=/sbin:/usr/sbin:/bin:/usr/bin" "PATH=${coreutils}:/bin"
37− substituteInPlace ./module/splat/splat-linux.c --replace "PATH=/sbin:/usr/sbin:/bin:/usr/bin" "PATH=${coreutils}:/bin"
38− '';
31+ preConfigure = ''
32+ substituteInPlace ./module/spl/spl-generic.c --replace /usr/bin/hostid hostid
33+ substituteInPlace ./module/spl/spl-generic.c --replace "PATH=/sbin:/usr/sbin:/bin:/usr/bin" "PATH=${coreutils}:${gawk}:/bin"
34+ substituteInPlace ./module/splat/splat-vnode.c --replace "PATH=/sbin:/usr/sbin:/bin:/usr/bin" "PATH=${coreutils}:/bin"
35+ substituteInPlace ./module/splat/splat-linux.c --replace "PATH=/sbin:/usr/sbin:/bin:/usr/bin" "PATH=${coreutils}:/bin"
36+ '';
3937
40− configureFlags = [
41− "--with-config=${configFile}"
42− ] ++ optionals buildKernel [
43− "--with-linux=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source"
44− "--with-linux-obj=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
45− ];
38+ configureFlags = [
39+ "--with-config=${configFile}"
40+ ] ++ optionals buildKernel [
41+ "--with-linux=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source"
42+ "--with-linux-obj=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
43+ ];
4644
47− enableParallelBuilding = true;
45+ enableParallelBuilding = true;
4846
49− meta = {
50− description = "Kernel module driver for solaris porting layer (needed by in-kernel zfs)";
47+ meta = {
48+ description = "Kernel module driver for solaris porting layer (needed by in-kernel zfs)";
5149
52− longDescription = ''
53− This kernel module is a porting layer for ZFS to work inside the linux
54− kernel.
55− '';
50+ longDescription = ''
51+ This kernel module is a porting layer for ZFS to work inside the linux
52+ kernel.
53+ '';
5654
57− homepage = http://zfsonlinux.org/;
58− platforms = platforms.linux;
59− license = licenses.gpl2Plus;
60− maintainers = with maintainers; [ jcumming wizeman wkennington fpletz globin ];
55+ homepage = http://zfsonlinux.org/;
56+ platforms = platforms.linux;
57+ license = licenses.gpl2Plus;
58+ maintainers = with maintainers; [ jcumming wizeman wkennington fpletz globin ];
59+ };
6160 };
61+in
62+ assert any (n: n == configFile) [ "kernel" "user" "all" ];
63+ assert buildKernel -> kernel != null;
64+{
65+ splStable = common {
66+ version = "0.7.1";
67+ sha256 = "0m8qhbdd8n40lbd91s30q4lrw8g169sha0410c8rwk2d5qfaxv9n";
68+ };
69+
70+ splUnstable = common {
71+ version = "2017-08-11";
72+ rev = "9df9692637aeee416f509c7f39655beb2d35b549";
73+ sha256 = "1dggf6xqgk2f7vccv6cgvr8krj7h9f921szp1j2qbxnnq41m37mi";
74+ };
6275}
pkgs/os-specific/linux/zfs/default.nix+155−104
@@ -13,112 +13,163 @@ let
1313 buildKernel = any (n: n == configFile) [ "kernel" "all" ];
1414 buildUser = any (n: n == configFile) [ "user" "all" ];
1515
16−in stdenv.mkDerivation rec {
17− name = "zfs-${configFile}-${version}${optionalString buildKernel "-${kernel.version}"}";
18− version = "0.7.1";
19−
20− src = fetchFromGitHub {
21− owner = "zfsonlinux";
22− repo = "zfs";
23− rev = "zfs-${version}";
16+ common = { version
17+ , sha256
18+ , extraPatches
19+ , spl
20+ , rev ? "zfs-${version}"
21+ , isUnstable ? false
22+ , incompatibleKernelVersion ? null } @ args:
23+ if buildKernel &&
24+ (incompatibleKernelVersion != null) &&
25+ versionAtLeast kernel.version incompatibleKernelVersion then
26+ throw ''
27+ Linux v${kernel.version} is not yet supported by zfsonlinux v${version}.
28+ ${stdenv.lib.optional (!isUnstable) "Try zfsUnstable or set the NixOS option boot.zfs.enableUnstable."}
29+ ''
30+ else stdenv.mkDerivation rec {
31+ name = "zfs-${configFile}-${version}${optionalString buildKernel "-${kernel.version}"}";
32+
33+ src = fetchFromGitHub {
34+ owner = "zfsonlinux";
35+ repo = "zfs";
36+ inherit rev sha256;
37+ };
38+
39+ patches = extraPatches;
40+
41+ buildInputs = [ autoreconfHook nukeReferences ]
42+ ++ optionals buildKernel [ spl ]
43+ ++ optionals buildUser [ zlib libuuid python attr ];
44+
45+ # for zdb to get the rpath to libgcc_s, needed for pthread_cancel to work
46+ NIX_CFLAGS_LINK = "-lgcc_s";
47+
48+ hardeningDisable = [ "pic" ];
49+
50+ preConfigure = ''
51+ substituteInPlace ./module/zfs/zfs_ctldir.c --replace "umount -t zfs" "${utillinux}/bin/umount -t zfs"
52+ substituteInPlace ./module/zfs/zfs_ctldir.c --replace "mount -t zfs" "${utillinux}/bin/mount -t zfs"
53+ substituteInPlace ./lib/libzfs/libzfs_mount.c --replace "/bin/umount" "${utillinux}/bin/umount"
54+ substituteInPlace ./lib/libzfs/libzfs_mount.c --replace "/bin/mount" "${utillinux}/bin/mount"
55+ substituteInPlace ./cmd/ztest/ztest.c --replace "/usr/sbin/ztest" "$out/sbin/ztest"
56+ substituteInPlace ./cmd/ztest/ztest.c --replace "/usr/sbin/zdb" "$out/sbin/zdb"
57+ substituteInPlace ./config/user-systemd.m4 --replace "/usr/lib/modules-load.d" "$out/etc/modules-load.d"
58+ substituteInPlace ./config/zfs-build.m4 --replace "\$sysconfdir/init.d" "$out/etc/init.d"
59+ substituteInPlace ./etc/zfs/Makefile.am --replace "\$(sysconfdir)" "$out/etc"
60+ substituteInPlace ./cmd/zed/Makefile.am --replace "\$(sysconfdir)" "$out/etc"
61+ substituteInPlace ./module/Makefile.in --replace "/bin/cp" "cp"
62+ substituteInPlace ./etc/systemd/system/zfs-share.service.in \
63+ --replace "@bindir@/rm " "${coreutils}/bin/rm "
64+
65+ for f in ./udev/rules.d/*
66+ do
67+ substituteInPlace "$f" --replace "/lib/udev/vdev_id" "$out/lib/udev/vdev_id"
68+ done
69+
70+ ./autogen.sh
71+ '';
72+
73+ configureFlags = [
74+ "--with-config=${configFile}"
75+ ] ++ optionals buildUser [
76+ "--with-dracutdir=$(out)/lib/dracut"
77+ "--with-udevdir=$(out)/lib/udev"
78+ "--with-systemdunitdir=$(out)/etc/systemd/system"
79+ "--with-systemdpresetdir=$(out)/etc/systemd/system-preset"
80+ "--with-mounthelperdir=$(out)/bin"
81+ "--sysconfdir=/etc"
82+ "--localstatedir=/var"
83+ "--enable-systemd"
84+ ] ++ optionals buildKernel [
85+ "--with-spl=${spl}/libexec/spl"
86+ "--with-linux=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source"
87+ "--with-linux-obj=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
88+ ];
89+
90+ enableParallelBuilding = true;
91+
92+ installFlags = [
93+ "sysconfdir=\${out}/etc"
94+ "DEFAULT_INITCONF_DIR=\${out}/default"
95+ ];
96+
97+ postInstall = ''
98+ # Prevent kernel modules from depending on the Linux -dev output.
99+ nuke-refs $(find $out -name "*.ko")
100+ '' + optionalString buildUser ''
101+ # Remove provided services as they are buggy
102+ rm $out/etc/systemd/system/zfs-import-*.service
103+
104+ sed -i '/zfs-import-scan.service/d' $out/etc/systemd/system/*
105+
106+ for i in $out/etc/systemd/system/*; do
107+ substituteInPlace $i --replace "zfs-import-cache.service" "zfs-import.target"
108+ done
109+
110+ # Fix pkgconfig.
111+ ln -s ../share/pkgconfig $out/lib/pkgconfig
112+
113+ # Remove tests because they add a runtime dependency on gcc
114+ rm -rf $out/share/zfs/zfs-tests
115+ '';
116+
117+ outputs = [ "out" ] ++ optionals buildUser [ "lib" "dev" ];
118+
119+ meta = {
120+ description = "ZFS Filesystem Linux Kernel module";
121+ longDescription = ''
122+ ZFS is a filesystem that combines a logical volume manager with a
123+ Copy-On-Write filesystem with data integrity detection and repair,
124+ snapshotting, cloning, block devices, deduplication, and more.
125+ '';
126+ home = http://zfsonlinux.org/;
127+ license = licenses.cddl;
128+ platforms = platforms.linux;
129+ maintainers = with maintainers; [ jcumming wizeman wkennington fpletz globin ];
130+ };
131+ };
132+in {
133+ # also check if kernel version constraints in
134+ # ./nixos/modules/tasks/filesystems/zfs.nix needs
135+ # to be adapted
136+ zfsStable = common {
137+ # comment/uncomment if breaking kernel versions are known
138+ incompatibleKernelVersion = null;
139+
140+ # this package should point to the latest release.
141+ version = "0.7.1";
142+
24143 sha256 = "0czal6lpl8igrhwmqh5jcgx07rlcgnrfg6ywzf681vsyh3gaxj9n";
144+
145+ extraPatches = [
146+ (fetchpatch {
147+ url = "https://github.com/Mic92/zfs/compare/zfs-0.7.0-rc3...nixos-zfs-0.7.0-rc3.patch";
148+ sha256 = "1vlw98v8xvi8qapzl1jwm69qmfslwnbg3ry1lmacndaxnyckkvhh";
149+ })
150+ ];
151+
152+ inherit spl;
25153 };
26154
27− patches = [
28− (fetchpatch {
29− url = "https://github.com/Mic92/zfs/compare/zfs-0.7.0-rc3...nixos-zfs-0.7.0-rc3.patch";
30− sha256 = "1vlw98v8xvi8qapzl1jwm69qmfslwnbg3ry1lmacndaxnyckkvhh";
31− })
32− ];
33−
34− buildInputs = [ autoreconfHook nukeReferences ]
35− ++ optionals buildKernel [ spl ]
36− ++ optionals buildUser [ zlib libuuid python attr ];
37−
38− # for zdb to get the rpath to libgcc_s, needed for pthread_cancel to work
39− NIX_CFLAGS_LINK = "-lgcc_s";
40−
41− hardeningDisable = [ "pic" ];
42−
43− preConfigure = ''
44− substituteInPlace ./module/zfs/zfs_ctldir.c --replace "umount -t zfs" "${utillinux}/bin/umount -t zfs"
45− substituteInPlace ./module/zfs/zfs_ctldir.c --replace "mount -t zfs" "${utillinux}/bin/mount -t zfs"
46− substituteInPlace ./lib/libzfs/libzfs_mount.c --replace "/bin/umount" "${utillinux}/bin/umount"
47− substituteInPlace ./lib/libzfs/libzfs_mount.c --replace "/bin/mount" "${utillinux}/bin/mount"
48− substituteInPlace ./cmd/ztest/ztest.c --replace "/usr/sbin/ztest" "$out/sbin/ztest"
49− substituteInPlace ./cmd/ztest/ztest.c --replace "/usr/sbin/zdb" "$out/sbin/zdb"
50− substituteInPlace ./config/user-systemd.m4 --replace "/usr/lib/modules-load.d" "$out/etc/modules-load.d"
51− substituteInPlace ./config/zfs-build.m4 --replace "\$sysconfdir/init.d" "$out/etc/init.d"
52− substituteInPlace ./etc/zfs/Makefile.am --replace "\$(sysconfdir)" "$out/etc"
53− substituteInPlace ./cmd/zed/Makefile.am --replace "\$(sysconfdir)" "$out/etc"
54− substituteInPlace ./module/Makefile.in --replace "/bin/cp" "cp"
55− substituteInPlace ./etc/systemd/system/zfs-share.service.in \
56− --replace "@bindir@/rm " "${coreutils}/bin/rm "
57−
58− for f in ./udev/rules.d/*
59− do
60− substituteInPlace "$f" --replace "/lib/udev/vdev_id" "$out/lib/udev/vdev_id"
61− done
62−
63− ./autogen.sh
64− '';
65−
66− configureFlags = [
67− "--with-config=${configFile}"
68− ] ++ optionals buildUser [
69− "--with-dracutdir=$(out)/lib/dracut"
70− "--with-udevdir=$(out)/lib/udev"
71− "--with-systemdunitdir=$(out)/etc/systemd/system"
72− "--with-systemdpresetdir=$(out)/etc/systemd/system-preset"
73− "--with-mounthelperdir=$(out)/bin"
74− "--sysconfdir=/etc"
75− "--localstatedir=/var"
76− "--enable-systemd"
77− ] ++ optionals buildKernel [
78− "--with-spl=${spl}/libexec/spl"
79− "--with-linux=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source"
80− "--with-linux-obj=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
81− ];
82−
83− enableParallelBuilding = true;
84−
85− installFlags = [
86− "sysconfdir=\${out}/etc"
87− "DEFAULT_INITCONF_DIR=\${out}/default"
88− ];
89−
90− postInstall = ''
91− # Prevent kernel modules from depending on the Linux -dev output.
92− nuke-refs $(find $out -name "*.ko")
93− '' + optionalString buildUser ''
94− # Remove provided services as they are buggy
95− rm $out/etc/systemd/system/zfs-import-*.service
96−
97− sed -i '/zfs-import-scan.service/d' $out/etc/systemd/system/*
98−
99− for i in $out/etc/systemd/system/*; do
100− substituteInPlace $i --replace "zfs-import-cache.service" "zfs-import.target"
101− done
102−
103− # Fix pkgconfig.
104− ln -s ../share/pkgconfig $out/lib/pkgconfig
105−
106− # Remove tests because they add a runtime dependency on gcc
107− rm -rf $out/share/zfs/zfs-tests
108− '';
109−
110− outputs = [ "out" ] ++ optionals buildUser [ "lib" "dev" ];
111−
112− meta = {
113− description = "ZFS Filesystem Linux Kernel module";
114− longDescription = ''
115− ZFS is a filesystem that combines a logical volume manager with a
116− Copy-On-Write filesystem with data integrity detection and repair,
117− snapshotting, cloning, block devices, deduplication, and more.
118− '';
119− homepage = http://zfsonlinux.org/;
120− license = licenses.cddl;
121− platforms = platforms.linux;
122− maintainers = with maintainers; [ jcumming wizeman wkennington fpletz globin ];
155+ zfsUnstable = common {
156+ # comment/uncomment if breaking kernel versions are known
157+ incompatibleKernelVersion = null;
158+
159+ # this package should point to a version / git revision compatible with the latest kernel release
160+ version = "2017-09-12";
161+
162+ rev = "ded8f06a3cfee60b3a8ea5309e9c4d0e567ed3b5";
163+ sha256 = "0yn4fg4a00hpflmmr0jbbhfb921nygpw2xbbjy35abl57k6zk375";
164+ isUnstable = true;
165+
166+ extraPatches = [
167+ (fetchpatch {
168+ url = "https://github.com/Mic92/zfs/compare/ded8f06a3cfee...nixos-zfs-2017-09-12.patch";
169+ sha256 = "033wf4jn0h0kp0h47ai98rywnkv5jwvf3xwym30phnaf8xxdx8aj";
170+ })
171+ ];
172+
173+ spl = splUnstable;
123174 };
124175}
pkgs/top-level/all-packages.nix+14−8
@@ -12376,10 +12376,12 @@ with pkgs;
1237612376
1237712377 sch_cake = callPackage ../os-specific/linux/sch_cake { };
1237812378
12379− spl = callPackage ../os-specific/linux/spl {
12379+ inherit (callPackage ../os-specific/linux/spl {
1238012380 configFile = "kernel";
1238112381 inherit kernel;
12382− };
12382+ }) splStable splUnstable;
12383+
12384+ spl = splStable;
1238312385
1238412386 sysdig = callPackage ../os-specific/linux/sysdig {};
1238512387
@@ -12403,10 +12405,12 @@ with pkgs;
1240312405
1240412406 x86_energy_perf_policy = callPackage ../os-specific/linux/x86_energy_perf_policy { };
1240512407
12406− zfs = callPackage ../os-specific/linux/zfs {
12408+ inherit (callPackage ../os-specific/linux/zfs {
1240712409 configFile = "kernel";
1240812410 inherit kernel spl;
12409− };
12411+ }) zfsStable zfsUnstable;
12412+
12413+ zfs = zfsStable;
1241012414 });
1241112415
1241212416 # The current default kernel / kernel modules.
@@ -12704,9 +12708,9 @@ with pkgs;
1270412708
1270512709 statifier = callPackage ../os-specific/linux/statifier { };
1270612710
12707− spl = callPackage ../os-specific/linux/spl {
12711+ inherit (callPackage ../os-specific/linux/spl {
1270812712 configFile = "user";
12709− };
12713+ }) splStable splUnstable;
1271012714
1271112715 sysdig = callPackage ../os-specific/linux/sysdig {
1271212716 kernel = null;
@@ -12910,9 +12914,11 @@ with pkgs;
1291012914
1291112915 zd1211fw = callPackage ../os-specific/linux/firmware/zd1211 { };
1291212916
12913− zfs = callPackage ../os-specific/linux/zfs {
12917+ inherit (callPackage ../os-specific/linux/zfs {
1291412918 configFile = "user";
12915− };
12919+ }) zfsStable zfsUnstable;
12920+
12921+ zfs = zfsStable;
1291612922
1291712923 ### DATA
1291812924