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

nixos/facter: add reportPath guard to all modules

Add lib.mkIf condition checking if config.hardware.facter.reportPath != null
to all facter modules. This shortcuts the module effects when no facter
report is available, preventing unnecessary evaluation and potential errors
when the report is not provided.
parent 79d683f4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ in
    '';
  };

  config = {
  config = lib.mkIf (config.hardware.facter.reportPath != null) {
    boot.initrd.availableKernelModules = config.hardware.facter.detected.boot.disk.kernelModules;
  };
}
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ let
  hasIntelCpu = facterLib.hasIntelCpu report;
in
{
  config = lib.mkIf isBaremetal {
  config = lib.mkIf (config.hardware.facter.reportPath != null && isBaremetal) {
    # none (e.g. bare-metal)
    # provide firmware for devices that might not have been detected by nixos-facter
    hardware.enableRedistributableFirmware = lib.mkDefault true;
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ in
      defaultText = "hardware dependent";
    };
  };
  config = lib.mkIf cfg.enable {
  config = lib.mkIf (config.hardware.facter.reportPath != null && cfg.enable) {
    services.xserver.videoDrivers = [ "modesetting" ];
  };
}
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ in
    };
  };

  config = lib.mkIf cfg.enable (
  config = lib.mkIf (config.hardware.facter.reportPath != null && cfg.enable) (
    {
      boot.initrd.kernelModules = config.hardware.facter.detected.boot.graphics.kernelModules;
    }
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ in
    '';
  };

  config = {
  config = lib.mkIf (config.hardware.facter.reportPath != null) {
    boot.initrd.availableKernelModules = config.hardware.facter.detected.boot.keyboard.kernelModules;
  };
}
Loading