Subject: [PATCH] gnu: zfs: Split into packages specific for each of our major supported kernel versions.

From: raid5atemyhomework <[email-masked]>
Date: Thu, 24 Dec 2020 10:59:56 +0000

Fixes: https://issues.guix.gnu.org/45401

Untested --- no idea how to repoint my guix to a temporary commit on my local file repo, would appreciate any guidance.

>From 242ee858b057f1c3ca4a80c9c449f710c5b1ff96 Mon Sep 17 00:00:00 2001
From: raid5atemyhomework <[email-masked]>
Date: Thu, 24 Dec 2020 10:54:17 +0000
Subject: [PATCH] gnu: zfs: Split into packages specific for each of our major
 supported kernel versions.

---
 gnu/packages/file-systems.scm | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index af587f73fe..d3cdeda4fb 100644
--- a/gnu/packages/file-systems.scm
+++ b/gnu/packages/file-systems.scm
@@ -843,7 +843,7 @@ APFS.")
       (home-page "https://github.com/sgan81/apfs-fuse")
       (license license:gpl2+))))

-(define-public zfs
+(define zfs-base
   (package
     (name "zfs")
     (version "0.8.5")
@@ -954,6 +954,35 @@ originally developed for Solaris and is now maintained by the OpenZFS
 community.")
     (license license:cddl1.0)))

+(define-public zfs
+  (package
+    (inherit zfs-base)
+    (description
+     (string-append (package-description zfs-base)
+                    "
+
+This package is deprecated, use linux-VERSION-zfs packages instead."))))
+
+(define (make-linux-zfs linux-libre)
+  (package
+    (inherit zfs-base)
+    (arguments
+     `(#:linux ,linux-libre)
+       ,@(package-arguments zfs-base))
+    (description
+     (string-append (package-description zfs-base)
+                    "
+
+This package will be compiled to work with the linux-libre "
+                    (package-version linux-libre)
+                    " kernel."))))
+
+(define-public linux-5.9-zfs (make-linux-zfs linux-libre-5.9))
+(define-public linux-5.4-zfs (make-linux-zfs linux-libre-5.4))
+(define-public linux-4.19-zfs (make-linux-zfs linux-libre-4.19))
+(define-public linux-4.14-zfs (make-linux-zfs linux-libre-4.14))
+(define-public linux-4.4-zfs (make-linux-zfs linux-libre-4.4))
+
 (define-public mergerfs
   (package
     (name "mergerfs")
--
2.29.2