nixos/facter: make hasCPUFeature more fault-tolerant
Add default value for features attribute in hasCPUFeature function to handle CPU records that might not have a features field, preventing errors when the report structure varies.
This commit is contained in:
@@ -57,7 +57,14 @@ in
|
||||
boot.kernelModules =
|
||||
let
|
||||
hasCPUFeature =
|
||||
feature: lib.any ({ features, ... }: lib.elem feature features) (report.hardware.cpu or [ ]);
|
||||
feature:
|
||||
lib.any (
|
||||
{
|
||||
features ? [ ],
|
||||
...
|
||||
}:
|
||||
lib.elem feature features
|
||||
) (report.hardware.cpu or [ ]);
|
||||
in
|
||||
lib.mkMerge [
|
||||
(lib.mkIf (hasCPUFeature "vmx") [ "kvm-intel" ])
|
||||
|
||||
Reference in New Issue
Block a user