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:
Jörg Thalheim
2025-11-05 22:57:03 +01:00
parent 3e758c612d
commit a555914285
@@ -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" ])