fix zfs latest again
This commit is contained in:
@@ -1,15 +1,11 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
# If we also need zfs, we can use the unstable version as we otherwise don't have a new enough kernel version
|
# If we also need zfs, we can use the unstable version as we otherwise don't have a new enough kernel version
|
||||||
boot.zfs.package = pkgs.zfsUnstable;
|
boot.zfs.package = pkgs.zfsUnstable;
|
||||||
boot.kernelPackages = lib.mkIf config.boot.zfs.enabled (
|
|
||||||
lib.mkForce config.boot.zfs.package.latestCompatibleLinuxPackages
|
|
||||||
);
|
|
||||||
|
|
||||||
# Enable bcachefs support
|
# Enable bcachefs support
|
||||||
boot.supportedFilesystems.bcachefs = lib.mkDefault true;
|
boot.supportedFilesystems.bcachefs = lib.mkDefault true;
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ in
|
|||||||
(modulesPath + "/profiles/installation-device.nix")
|
(modulesPath + "/profiles/installation-device.nix")
|
||||||
(modulesPath + "/profiles/all-hardware.nix")
|
(modulesPath + "/profiles/all-hardware.nix")
|
||||||
(modulesPath + "/profiles/base.nix")
|
(modulesPath + "/profiles/base.nix")
|
||||||
|
./zfs-latest.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.nixos-facter ];
|
environment.systemPackages = [ pkgs.nixos-facter ];
|
||||||
|
|||||||
28
nixosModules/installer/zfs-latest.nix
Normal file
28
nixosModules/installer/zfs-latest.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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user