Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkgs/os-specific/linux/zfs/2_2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ callPackage ./generic.nix args {
# You have to ensure that in `pkgs/top-level/linux-kernels.nix`
# this attribute is the correct one for this package.
kernelModuleAttribute = "zfs_2_2";
# check the release notes for compatible kernels
kernelCompatible = kernel: kernel.kernelOlder "6.16";

kernelMinSupportedMajorMinor = "4.18";
kernelMaxSupportedMajorMinor = "6.15";

# this package should point to the latest release.
version = "2.2.8";
Expand Down
5 changes: 3 additions & 2 deletions pkgs/os-specific/linux/zfs/2_3.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ callPackage ./generic.nix args {
# You have to ensure that in `pkgs/top-level/linux-kernels.nix`
# this attribute is the correct one for this package.
kernelModuleAttribute = "zfs_2_3";
# check the release notes for compatible kernels
kernelCompatible = kernel: kernel.kernelOlder "6.16";

kernelMinSupportedMajorMinor = "4.18";
kernelMaxSupportedMajorMinor = "6.15";

# this package should point to the latest release.
version = "2.3.3";
Expand Down
31 changes: 29 additions & 2 deletions pkgs/os-specific/linux/zfs/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ let
extraLongDescription ? "",
extraPatches ? [ ],
rev ? "zfs-${version}",
kernelCompatible ? null,
kernelMinSupportedMajorMinor,
kernelMaxSupportedMajorMinor,
enableUnsupportedExperimentalKernel ? false, # allows building against unsupported Kernel versions
maintainers ? (with lib.maintainers; [ amarshall ]),
tests,
}@innerArgs:
Expand All @@ -72,6 +74,22 @@ let
"user"
"all"
];
kernelIsCompatible =
kernel:
let
nextMajorMinor =
ver:
"${lib.versions.major ver}.${
lib.pipe ver [
lib.versions.minor
lib.toInt
(x: x + 1)
toString
]
}";
in
(lib.versionAtLeast kernel.version kernelMinSupportedMajorMinor)
&& (lib.versionOlder kernel.version (nextMajorMinor kernelMaxSupportedMajorMinor));

# XXX: You always want to build kernel modules with the same stdenv as the
# kernel was built with. However, since zfs can also be built for userspace we
Expand Down Expand Up @@ -139,6 +157,14 @@ let
"bashcompletiondir=$out/share/bash-completion/completions"

substituteInPlace ./cmd/arc_summary --replace-fail "/sbin/modinfo" "modinfo"
''
+ ''
echo 'Supported Kernel versions:'
grep '^Linux-' META
echo 'Checking kernelMinSupportedMajorMinor is correct...'
grep --quiet '^Linux-Minimum: *${lib.escapeRegex kernelMinSupportedMajorMinor}$' META
echo 'Checking kernelMaxSupportedMajorMinor is correct...'
grep --quiet '^Linux-Maximum: *${lib.escapeRegex kernelMaxSupportedMajorMinor}$' META
'';

nativeBuildInputs = [
Expand Down Expand Up @@ -176,6 +202,7 @@ let
"--with-tirpc=1"
(lib.withFeatureAs (buildUser && enablePython) "python" python3.interpreter)
]
++ optional enableUnsupportedExperimentalKernel "--enable-linux-experimental"
++ optionals buildUser [
"--with-dracutdir=$(out)/lib/dracut"
"--with-udevdir=$(out)/lib/udev"
Expand Down Expand Up @@ -330,7 +357,7 @@ let

inherit maintainers;
mainProgram = "zfs";
broken = buildKernel && (kernelCompatible != null) && !(kernelCompatible kernel);
broken = buildKernel && !((kernelIsCompatible kernel) || enableUnsupportedExperimentalKernel);
};
};
in
Expand Down
5 changes: 3 additions & 2 deletions pkgs/os-specific/linux/zfs/unstable.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ callPackage ./generic.nix args {
# You have to ensure that in `pkgs/top-level/linux-kernels.nix`
# this attribute is the correct one for this package.
kernelModuleAttribute = "zfs_unstable";
# check the release notes for compatible kernels
kernelCompatible = kernel: kernel.kernelOlder "6.16";

kernelMinSupportedMajorMinor = "4.18";
kernelMaxSupportedMajorMinor = "6.15";

# this package should point to a version / git revision compatible with the latest kernel release
# IMPORTANT: Always use a tagged release candidate or commits from the
Expand Down
Loading