-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from numtide/hardware-config
move all hardware detection to its own namespace
- Loading branch information
Showing
11 changed files
with
78 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ lib, config, ... }: | ||
{ | ||
options.facter.bluetooth.enable = lib.mkEnableOption "Enable the Facter bluetooth module" // { | ||
options.facter.detected.bluetooth.enable = lib.mkEnableOption "Enable the Facter bluetooth module" // { | ||
default = builtins.length (config.facter.report.hardware.bluetooth or []) > 0; | ||
}; | ||
|
||
config.hardware.bluetooth.enable = lib.mkIf config.facter.bluetooth.enable (lib.mkDefault true); | ||
config.hardware.bluetooth.enable = lib.mkIf config.facter.detected.bluetooth.enable (lib.mkDefault true); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ lib, config, ... }: | ||
let | ||
facterLib = import ../../lib/lib.nix lib; | ||
|
||
inherit (config.facter) report; | ||
in | ||
{ | ||
options.facter.detected.boot.disk.kernelModules = lib.mkOption { | ||
type = lib.types.listOf lib.types.str; | ||
default = facterLib.stringSet ( | ||
facterLib.collectDrivers ( | ||
# A disk might be attached. | ||
(report.hardware.firewire_controller or [ ]) | ||
# definitely important | ||
++ (report.hardware.disk or [ ]) | ||
++ (report.hardware.storage_controller or [ ]) | ||
) | ||
); | ||
description = '' | ||
List of kernel modules that are needed to access the disk. | ||
''; | ||
}; | ||
|
||
config = { | ||
boot.initrd.availableKernelModules = config.facter.detected.boot.disk.kernelModules; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
{ lib, config, ... }: | ||
let | ||
facterLib = import ../../lib/lib.nix lib; | ||
cfg = config.facter.detected.graphics; | ||
in | ||
{ | ||
options.facter.graphics.enable = lib.mkEnableOption "Enable the Graphics module" // { | ||
default = builtins.length (config.facter.report.hardware.monitor or [ ]) > 0; | ||
options.facter.detected = { | ||
graphics.enable = lib.mkEnableOption "Enable the Graphics module" // { | ||
default = builtins.length (config.facter.report.hardware.monitor or [ ]) > 0; | ||
}; | ||
boot.graphics.kernelModules = lib.mkOption { | ||
type = lib.types.listOf lib.types.str; | ||
# We currently don't auto import nouveau, in case the user might want to use the proprietary nvidia driver, | ||
# We might want to change this in future, if we have a better idea, how to handle this. | ||
default = lib.remove "nouveau" ( | ||
facterLib.stringSet (facterLib.collectDrivers (config.facter.report.hardware.graphics_card or [ ])) | ||
); | ||
description = '' | ||
List of kernel modules to load at boot for the graphics card. | ||
''; | ||
}; | ||
}; | ||
|
||
config = lib.mkIf config.facter.graphics.enable { | ||
config = lib.mkIf cfg.enable { | ||
hardware.graphics.enable = lib.mkDefault true; | ||
boot.initrd.kernelModules = facterLib.stringSet ( | ||
facterLib.collectDrivers (config.facter.report.hardware.graphics_card or [ ]) | ||
); | ||
boot.initrd.kernelModules = config.facter.detected.boot.graphics.kernelModules; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ lib, config, ... }: | ||
let | ||
facterLib = import ../../lib/lib.nix lib; | ||
|
||
inherit (config.facter) report; | ||
in | ||
{ | ||
options.facter.detected.boot.keyboard.kernelModules = lib.mkOption { | ||
type = lib.types.listOf lib.types.str; | ||
default = facterLib.collectDrivers (report.hardware.usb_controller or [ ]); | ||
example = [ "usbhid" ]; | ||
description = '' | ||
List of kernel modules to include in the initrd to support the keyboard. | ||
''; | ||
}; | ||
|
||
config = { | ||
boot.initrd.availableKernelModules = config.facter.detected.boot.keyboard.kernelModules; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters