Files
nixpkgs/nixos/modules/hardware/facter/keyboard.nix
Jörg Thalheim 3e758c612d 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.
2025-11-05 22:57:03 +01:00

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;
};
}