Commit a5559142 authored by Jörg Thalheim's avatar Jörg Thalheim
Browse files

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.
parent 3e758c61
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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" ])