File tree Expand file tree Collapse file tree 11 files changed +78
-63
lines changed Expand file tree Collapse file tree 11 files changed +78
-63
lines changed Original file line number Diff line number Diff line change @@ -65,25 +65,9 @@ pkgs.mkShellNoCC {
65
65
cat ${ optionsDoc . optionsCommonMark } > $out/${ snakeCase name } .md
66
66
'' ;
67
67
68
- # Allows us to gather all options that are immediate children of `facter` and which have no child options.
69
- # e.g. facter.reportPath, facter.report.
70
- # For all other options we group them by the first immediate child of `facter`.
71
- # e.g. facter.bluetooth, facter.boot and so on.
72
- # This allows us to have a page for root facter options "facter.md", and a page each for the major sub modules.
73
- facterOptionsFilter =
74
- _ :
75
- {
76
- loc ? [ ] ,
77
- options ? [ ] ,
78
- ...
79
- } :
80
- ( lib . length loc ) == 2 && ( ( lib . elemAt loc 0 ) == "facter" ) && ( lib . length options ) == 0 ;
81
-
82
- otherOptionsFilter = n : v : ! ( facterOptionsFilter n v ) ;
83
-
84
- facterMarkdown = mkMarkdown "facter" ( lib . filterAttrs facterOptionsFilter eval . options . facter ) ;
68
+ facterMarkdown = mkMarkdown "facter" eval . options . facter . detected ;
85
69
otherMarkdown = lib . mapAttrsToList mkMarkdown (
86
- lib . filterAttrs otherOptionsFilter eval . options . facter
70
+ lib . filterAttrs ( n : v : n != "detected" ) eval . options . facter
87
71
) ;
88
72
89
73
optionsMarkdown = pkgs . symlinkJoin {
@@ -92,7 +76,6 @@ pkgs.mkShellNoCC {
92
76
} ;
93
77
94
78
in
95
- with pkgs ;
96
79
[
97
80
( pkgs . writeScriptBin "mkdocs" ''
98
81
# rsync in NixOS modules doc to avoid issues with symlinks being owned by root
Original file line number Diff line number Diff line change 1
1
{ lib , config , ... } :
2
2
{
3
- options . facter . bluetooth . enable = lib . mkEnableOption "Enable the Facter bluetooth module" // {
3
+ options . facter . detected . bluetooth . enable = lib . mkEnableOption "Enable the Facter bluetooth module" // {
4
4
default = builtins . length ( config . facter . report . hardware . bluetooth or [ ] ) > 0 ;
5
5
} ;
6
6
7
- config . hardware . bluetooth . enable = lib . mkIf config . facter . bluetooth . enable ( lib . mkDefault true ) ;
7
+ config . hardware . bluetooth . enable = lib . mkIf config . facter . detected . bluetooth . enable ( lib . mkDefault true ) ;
8
8
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ { lib , config , ... } :
2
+ let
3
+ facterLib = import ../../lib/lib.nix lib ;
4
+
5
+ inherit ( config . facter ) report ;
6
+ in
7
+ {
8
+ options . facter . detected . boot . disk . kernelModules = lib . mkOption {
9
+ type = lib . types . listOf lib . types . str ;
10
+ default = facterLib . stringSet (
11
+ facterLib . collectDrivers (
12
+ # A disk might be attached.
13
+ ( report . hardware . firewire_controller or [ ] )
14
+ # definitely important
15
+ ++ ( report . hardware . disk or [ ] )
16
+ ++ ( report . hardware . storage_controller or [ ] )
17
+ )
18
+ ) ;
19
+ description = ''
20
+ List of kernel modules that are needed to access the disk.
21
+ '' ;
22
+ } ;
23
+
24
+ config = {
25
+ boot . initrd . availableKernelModules = config . facter . detected . boot . disk . kernelModules ;
26
+ } ;
27
+ }
Original file line number Diff line number Diff line change 11
11
{
12
12
imports = [
13
13
./bluetooth.nix
14
- ./boot.nix
14
+ ./disk.nix
15
+ ./keyboard.nix
15
16
./firmware.nix
16
17
./graphics.nix
17
18
./networking
Original file line number Diff line number Diff line change 3
3
facterLib = import ../../lib/lib.nix lib ;
4
4
5
5
inherit ( config . facter ) report ;
6
- isBaremetal = config . facter . virtualisation . none . enable ;
6
+ isBaremetal = config . facter . detected . virtualisation . none . enable ;
7
7
hasAmdCpu = facterLib . hasAmdCpu report ;
8
8
hasIntelCpu = facterLib . hasIntelCpu report ;
9
9
in
Original file line number Diff line number Diff line change 1
1
{ lib , config , ... } :
2
2
let
3
3
facterLib = import ../../lib/lib.nix lib ;
4
+ cfg = config . facter . detected . graphics ;
4
5
in
5
6
{
6
- options . facter . graphics . enable = lib . mkEnableOption "Enable the Graphics module" // {
7
- default = builtins . length ( config . facter . report . hardware . monitor or [ ] ) > 0 ;
7
+ options . facter . detected = {
8
+ graphics . enable = lib . mkEnableOption "Enable the Graphics module" // {
9
+ default = builtins . length ( config . facter . report . hardware . monitor or [ ] ) > 0 ;
10
+ } ;
11
+ boot . graphics . kernelModules = lib . mkOption {
12
+ type = lib . types . listOf lib . types . str ;
13
+ # We currently don't auto import nouveau, in case the user might want to use the proprietary nvidia driver,
14
+ # We might want to change this in future, if we have a better idea, how to handle this.
15
+ default = lib . remove "nouveau" (
16
+ facterLib . stringSet ( facterLib . collectDrivers ( config . facter . report . hardware . graphics_card or [ ] ) )
17
+ ) ;
18
+ description = ''
19
+ List of kernel modules to load at boot for the graphics card.
20
+ '' ;
21
+ } ;
8
22
} ;
9
23
10
- config = lib . mkIf config . facter . graphics . enable {
24
+ config = lib . mkIf cfg . enable {
11
25
hardware . graphics . enable = lib . mkDefault true ;
12
- boot . initrd . kernelModules = facterLib . stringSet (
13
- facterLib . collectDrivers ( config . facter . report . hardware . graphics_card or [ ] )
14
- ) ;
26
+ boot . initrd . kernelModules = config . facter . detected . boot . graphics . kernelModules ;
15
27
} ;
16
28
}
Original file line number Diff line number Diff line change
1
+ { lib , config , ... } :
2
+ let
3
+ facterLib = import ../../lib/lib.nix lib ;
4
+
5
+ inherit ( config . facter ) report ;
6
+ in
7
+ {
8
+ options . facter . detected . boot . keyboard . kernelModules = lib . mkOption {
9
+ type = lib . types . listOf lib . types . str ;
10
+ default = facterLib . collectDrivers ( report . hardware . usb_controller or [ ] ) ;
11
+ example = [ "usbhid" ] ;
12
+ description = ''
13
+ List of kernel modules to include in the initrd to support the keyboard.
14
+ '' ;
15
+ } ;
16
+
17
+ config = {
18
+ boot . initrd . availableKernelModules = config . facter . detected . boot . keyboard . kernelModules ;
19
+ } ;
20
+ }
Original file line number Diff line number Diff line change 1
1
{ lib , config , ... } :
2
2
let
3
3
inherit ( config . facter ) report ;
4
- cfg = config . facter . networking . broadcom ;
4
+ cfg = config . facter . detected . networking . broadcom ;
5
5
in
6
6
{
7
- options . facter . networking . broadcom = with lib ; {
7
+ options . facter . detected . networking . broadcom = with lib ; {
8
8
full_mac . enable = mkEnableOption "Enable the Facter Broadcom Full MAC module" // {
9
9
10
10
default = lib . any (
Original file line number Diff line number Diff line change 1
1
{ lib , config , ... } :
2
2
let
3
3
inherit ( config . facter ) report ;
4
- cfg = config . facter . networking . intel ;
4
+ cfg = config . facter . detected . networking . intel ;
5
5
in
6
6
{
7
- options . facter . networking . intel = with lib ; {
7
+ options . facter . detected . networking . intel = with lib ; {
8
8
_2200BG . enable = mkEnableOption "Enable the Facter Intel 2200BG module" // {
9
9
10
10
default = lib . any (
Original file line number Diff line number Diff line change 6
6
} :
7
7
let
8
8
inherit ( config . facter ) report ;
9
- cfg = config . facter . virtualisation ;
9
+ cfg = config . facter . detected . virtualisation ;
10
10
in
11
11
{
12
- options . facter . virtualisation = {
12
+ options . facter . detected . virtualisation = {
13
13
virtio_scsi . enable = lib . mkEnableOption "Enable the Facter Virtualisation Virtio SCSI module" // {
14
14
default = lib . any (
15
15
{ vendor , device , ... } :
You can’t perform that action at this time.
0 commit comments