Restore the latest compatible ZFS kernel function
This commit is contained in:
parent
bdadda5249
commit
4f0ab8b741
@ -11,7 +11,6 @@ with pkgs;
|
|||||||
{
|
{
|
||||||
# Kernel configuration
|
# Kernel configuration
|
||||||
boot = {
|
boot = {
|
||||||
kernelPackages = linuxPackages_zen;
|
|
||||||
blacklistedKernelModules = [
|
blacklistedKernelModules = [
|
||||||
"btusb"
|
"btusb"
|
||||||
"bluetooth"
|
"bluetooth"
|
||||||
@ -183,6 +182,7 @@ with pkgs;
|
|||||||
./modules/periodic.nix
|
./modules/periodic.nix
|
||||||
./modules/power.nix
|
./modules/power.nix
|
||||||
./modules/monitoring.nix
|
./modules/monitoring.nix
|
||||||
|
./modules/latest-zfs-kernel.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
28
modules/latest-zfs-kernel.nix
Normal file
28
modules/latest-zfs-kernel.nix
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
isUnstable = config.boot.zfs.package == pkgs.zfsUnstable;
|
||||||
|
zfsCompatibleKernelPackages = lib.filterAttrs (
|
||||||
|
name: kernelPackages:
|
||||||
|
(builtins.match "linux_[0-9]+_[0-9]+" name) != null
|
||||||
|
&& (builtins.tryEval kernelPackages).success
|
||||||
|
&& (
|
||||||
|
(!isUnstable && !kernelPackages.zfs.meta.broken)
|
||||||
|
|| (isUnstable && !kernelPackages.zfs_unstable.meta.broken)
|
||||||
|
)
|
||||||
|
) pkgs.linuxKernel.packages;
|
||||||
|
latestKernelPackage = lib.last (
|
||||||
|
lib.sort (a: b: (lib.versionOlder a.kernel.version b.kernel.version)) (
|
||||||
|
builtins.attrValues zfsCompatibleKernelPackages
|
||||||
|
)
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# Note this might jump back and worth as kernel get added or removed.
|
||||||
|
boot.kernelPackages = latestKernelPackage;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user