1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00

zfs: dynamically determine latestCompatibleLinuxPackages

This removes the need to micromanage this value, instead we simply find
the correct one based on the existing kernelCompatible attr (though that
is now a function). This not only simplifies ZFS upgrades, but also
whenever Kernel versions are removed due to EOL.

(cherry picked from commit 7fa05c77b7)
(cherry picked from commit 34e1748391)
(cherry picked from commit d174eca1fa)
This commit is contained in:
Andrew Marshall 2024-08-14 12:54:16 -04:00
parent fe1ef01f1e
commit 27b52adcb4
4 changed files with 12 additions and 15 deletions

View file

@ -1,7 +1,6 @@
{ callPackage { callPackage
, kernel ? null , kernel ? null
, stdenv , stdenv
, linuxKernel
, lib , lib
, nixosTests , nixosTests
, ... , ...
@ -15,9 +14,7 @@ callPackage ./generic.nix args {
# this attribute is the correct one for this package. # this attribute is the correct one for this package.
kernelModuleAttribute = "zfs_2_1"; kernelModuleAttribute = "zfs_2_1";
# check the release notes for compatible kernels # check the release notes for compatible kernels
kernelCompatible = kernel.kernelOlder "6.8"; kernelCompatible = kernel: kernel.kernelOlder "6.8";
latestCompatibleLinuxPackages = linuxKernel.packages.linux_6_6;
# This is a fixed version to the 2.1.x series, move only # This is a fixed version to the 2.1.x series, move only
# if the 2.1.x series moves. # if the 2.1.x series moves.

View file

@ -2,7 +2,6 @@
, kernel ? null , kernel ? null
, stdenv , stdenv
, lib , lib
, linuxKernel
, nixosTests , nixosTests
, ... , ...
} @ args: } @ args:
@ -15,9 +14,7 @@ callPackage ./generic.nix args {
# this attribute is the correct one for this package. # this attribute is the correct one for this package.
kernelModuleAttribute = "zfs_2_2"; kernelModuleAttribute = "zfs_2_2";
# check the release notes for compatible kernels # check the release notes for compatible kernels
kernelCompatible = kernel.kernelOlder "6.10"; kernelCompatible = kernel: kernel.kernelOlder "6.10";
latestCompatibleLinuxPackages = linuxKernel.packages.linux_6_6;
# this package should point to the latest release. # this package should point to the latest release.
version = "2.2.5"; version = "2.2.5";

View file

@ -2,6 +2,7 @@ let
genericBuild = genericBuild =
{ pkgs, lib, stdenv, fetchFromGitHub, fetchpatch { pkgs, lib, stdenv, fetchFromGitHub, fetchpatch
, autoreconfHook269, util-linux, nukeReferences, coreutils , autoreconfHook269, util-linux, nukeReferences, coreutils
, linuxKernel
, perl , perl
, configFile ? "all" , configFile ? "all"
@ -27,7 +28,6 @@ let
, kernelModuleAttribute , kernelModuleAttribute
, extraPatches ? [] , extraPatches ? []
, rev ? "zfs-${version}" , rev ? "zfs-${version}"
, latestCompatibleLinuxPackages
, kernelCompatible ? null , kernelCompatible ? null
, maintainers ? (with lib.maintainers; [ amarshall ]) , maintainers ? (with lib.maintainers; [ amarshall ])
, tests , tests
@ -198,7 +198,13 @@ let
outputs = [ "out" ] ++ optionals buildUser [ "dev" ]; outputs = [ "out" ] ++ optionals buildUser [ "dev" ];
passthru = { passthru = {
inherit enableMail latestCompatibleLinuxPackages kernelModuleAttribute; inherit enableMail kernelModuleAttribute;
latestCompatibleLinuxPackages = lib.pipe linuxKernel.packages [
builtins.attrValues
(builtins.filter (kPkgs: (builtins.tryEval kPkgs).success && kPkgs ? kernel && kPkgs.kernel.pname == "linux" && kernelCompatible kPkgs.kernel))
(builtins.sort (a: b: (lib.versionOlder a.kernel.version b.kernel.version)))
lib.last
];
# The corresponding userspace tools to this instantiation # The corresponding userspace tools to this instantiation
# of the ZFS package set. # of the ZFS package set.
userspaceTools = genericBuild (outerArgs // { userspaceTools = genericBuild (outerArgs // {
@ -235,7 +241,7 @@ let
mainProgram = "zfs"; mainProgram = "zfs";
# If your Linux kernel version is not yet supported by zfs, try zfs_unstable. # If your Linux kernel version is not yet supported by zfs, try zfs_unstable.
# On NixOS set the option `boot.zfs.package = pkgs.zfs_unstable`. # On NixOS set the option `boot.zfs.package = pkgs.zfs_unstable`.
broken = buildKernel && (kernelCompatible != null) && !kernelCompatible; broken = buildKernel && (kernelCompatible != null) && !(kernelCompatible kernel);
}; };
}; };
in in

View file

@ -1,7 +1,6 @@
{ callPackage { callPackage
, kernel ? null , kernel ? null
, stdenv , stdenv
, linuxKernel
, nixosTests , nixosTests
, ... , ...
} @ args: } @ args:
@ -14,9 +13,7 @@ callPackage ./generic.nix args {
# this attribute is the correct one for this package. # this attribute is the correct one for this package.
kernelModuleAttribute = "zfs_unstable"; kernelModuleAttribute = "zfs_unstable";
# check the release notes for compatible kernels # check the release notes for compatible kernels
kernelCompatible = kernel.kernelOlder "6.11"; kernelCompatible = kernel: kernel.kernelOlder "6.11";
latestCompatibleLinuxPackages = linuxKernel.packages.linux_6_10;
# this package should point to a version / git revision compatible with the latest kernel release # 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 # IMPORTANT: Always use a tagged release candidate or commits from the