nixos/facter: add boot and storage detection (#454847)
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
./disk.nix
|
||||||
|
./keyboard.nix
|
||||||
./system.nix
|
./system.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
28
nixos/modules/hardware/facter/disk.nix
Normal file
28
nixos/modules/hardware/facter/disk.nix
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{ lib, config, ... }:
|
||||||
|
let
|
||||||
|
facterLib = import ./lib.nix lib;
|
||||||
|
|
||||||
|
inherit (config.hardware.facter) report;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.hardware.facter.detected.boot.disk.kernelModules = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = lib.uniqueStrings (
|
||||||
|
facterLib.collectDrivers (
|
||||||
|
# A disk might be attached.
|
||||||
|
(report.hardware.firewire_controller or [ ])
|
||||||
|
# definitely important
|
||||||
|
++ (report.hardware.disk or [ ])
|
||||||
|
++ (report.hardware.storage_controller or [ ])
|
||||||
|
)
|
||||||
|
);
|
||||||
|
defaultText = "hardware dependent";
|
||||||
|
description = ''
|
||||||
|
List of kernel modules that are needed to access the disk.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
boot.initrd.availableKernelModules = config.hardware.facter.detected.boot.disk.kernelModules;
|
||||||
|
};
|
||||||
|
}
|
||||||
21
nixos/modules/hardware/facter/keyboard.nix
Normal file
21
nixos/modules/hardware/facter/keyboard.nix
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{ 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 = {
|
||||||
|
boot.initrd.availableKernelModules = config.hardware.facter.detected.boot.keyboard.kernelModules;
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user