summary refs log tree commit diff
path: root/pkgs/os-specific/linux/zfs
diff options
context:
space:
mode:
authorAtemu <atemu.main@gmail.com>2021-01-11 17:22:40 +0100
committerAtemu <atemu.main@gmail.com>2021-01-21 14:58:00 +0100
commitaa58df5312b58695ab43f40f450cc6de8bca06cc (patch)
treedce1535174d5669961de8a54d95e11f8670a4d77 /pkgs/os-specific/linux/zfs
parentb97a90532e00601a26568bca60d850a277b142c5 (diff)
downloadnixpkgs-aa58df5312b58695ab43f40f450cc6de8bca06cc.tar
nixpkgs-aa58df5312b58695ab43f40f450cc6de8bca06cc.tar.gz
nixpkgs-aa58df5312b58695ab43f40f450cc6de8bca06cc.tar.bz2
nixpkgs-aa58df5312b58695ab43f40f450cc6de8bca06cc.tar.lz
nixpkgs-aa58df5312b58695ab43f40f450cc6de8bca06cc.tar.xz
nixpkgs-aa58df5312b58695ab43f40f450cc6de8bca06cc.tar.zst
nixpkgs-aa58df5312b58695ab43f40f450cc6de8bca06cc.zip
zfs: use meta.broken instead of throw when incompatible with kernel
`throw` aborts eval when the package is touched in inappropriate places. See
https://github.com/NixOS/nixpkgs/issues/109001 for an adverse instance of that.

ZFS now behaves like a regular broken package when it's, you know, broken.

It also still prints the helpful incompatibility notice when fully evaluated.
Diffstat (limited to 'pkgs/os-specific/linux/zfs')
-rw-r--r--pkgs/os-specific/linux/zfs/default.nix17
1 files changed, 9 insertions, 8 deletions
diff --git a/pkgs/os-specific/linux/zfs/default.nix b/pkgs/os-specific/linux/zfs/default.nix
index 61313f08f31..86deebb5014 100644
--- a/pkgs/os-specific/linux/zfs/default.nix
+++ b/pkgs/os-specific/linux/zfs/default.nix
@@ -27,14 +27,8 @@ let
     , rev ? "zfs-${version}"
     , isUnstable ? false
     , incompatibleKernelVersion ? null }:
-    if buildKernel &&
-      (incompatibleKernelVersion != null) &&
-        versionAtLeast kernel.version incompatibleKernelVersion then
-       throw ''
-         Linux v${kernel.version} is not yet supported by zfsonlinux v${version}.
-         ${lib.optionalString (!isUnstable) "Try zfsUnstable or set the NixOS option boot.zfs.enableUnstable."}
-       ''
-    else stdenv.mkDerivation {
+
+    stdenv.mkDerivation {
       name = "zfs-${configFile}-${version}${optionalString buildKernel "-${kernel.version}"}";
 
       src = fetchFromGitHub {
@@ -174,6 +168,13 @@ let
         license = licenses.cddl;
         platforms = platforms.linux;
         maintainers = with maintainers; [ hmenke jcumming jonringer wizeman fpletz globin mic92 ];
+        broken = if
+          buildKernel && (incompatibleKernelVersion != null) && versionAtLeast kernel.version incompatibleKernelVersion
+          then builtins.trace ''
+            Linux v${kernel.version} is not yet supported by zfsonlinux v${version}.
+            ${lib.optionalString (!isUnstable) "Try zfsUnstable or set the NixOS option boot.zfs.enableUnstable."}
+          '' true
+          else false;
       };
     };
 in {