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.
22 lines
691 B
Nix
22 lines
691 B
Nix
{ lib, config, ... }:
|
|
let
|
|
facterLib = import ./lib.nix lib;
|
|
|
|
inherit (config.hardware.facter) report;
|
|
in
|
|
{
|
|
options.hardware.facter.detected.boot.keyboard.kernelModules = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
default = lib.uniqueStrings (facterLib.collectDrivers (report.hardware.usb_controller or [ ]));
|
|
defaultText = "hardware dependent";
|
|
example = [ "usbhid" ];
|
|
description = ''
|
|
List of kernel modules to include in the initrd to support the keyboard.
|
|
'';
|
|
};
|
|
|
|
config = lib.mkIf (config.hardware.facter.reportPath != null) {
|
|
boot.initrd.availableKernelModules = config.hardware.facter.detected.boot.keyboard.kernelModules;
|
|
};
|
|
}
|