-
-
Notifications
You must be signed in to change notification settings - Fork 15.6k
nixos/kernel: Module inclusion improvements #375975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ElvishJerricco
wants to merge
3
commits into
NixOS:staging-next
Choose a base branch
from
ElvishJerricco:push-lsvukqwlwnqo
base: staging-next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+85
−26
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -8,6 +8,14 @@ let | |
inherit (config.boot.kernel) features randstructSeed; | ||
inherit (config.boot.kernelPackages) kernel; | ||
|
||
modulesTypeDesc = '' | ||
This can either be a list of modules, or an attrset. In an | ||
attrset, names that are set to `true` represent modules that will | ||
be included. Note that setting these names to `false` does not | ||
prevent the module from being loaded. For that, use | ||
{option}`boot.blacklistedKernelModules`. | ||
''; | ||
Comment on lines
+11
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should it be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand. That isn't what these options do. |
||
|
||
kernelModulesConf = pkgs.writeText "nixos.conf" | ||
'' | ||
${concatStringsSep "\n" config.boot.kernelModules} | ||
|
@@ -175,20 +183,23 @@ in | |
}; | ||
|
||
boot.kernelModules = mkOption { | ||
type = types.listOf types.str; | ||
default = []; | ||
type = types.attrNamesToTrue; | ||
default = { }; | ||
description = '' | ||
The set of kernel modules to be loaded in the second stage of | ||
the boot process. Note that modules that are needed to | ||
mount the root file system should be added to | ||
{option}`boot.initrd.availableKernelModules` or | ||
{option}`boot.initrd.kernelModules`. | ||
|
||
${modulesTypeDesc} | ||
''; | ||
apply = mods: lib.attrNames (lib.filterAttrs (_: v: v) mods); | ||
}; | ||
|
||
boot.initrd.availableKernelModules = mkOption { | ||
type = types.listOf types.str; | ||
default = []; | ||
type = types.attrNamesToTrue; | ||
default = { }; | ||
example = [ "sata_nv" "ext3" ]; | ||
description = '' | ||
The set of kernel modules in the initial ramdisk used during the | ||
|
@@ -204,13 +215,21 @@ in | |
modules for PCI devices are loaded when they match the PCI ID | ||
of a device in your system). To force a module to be loaded, | ||
include it in {option}`boot.initrd.kernelModules`. | ||
|
||
${modulesTypeDesc} | ||
''; | ||
apply = mods: lib.attrNames (lib.filterAttrs (_: v: v) mods); | ||
}; | ||
|
||
boot.initrd.kernelModules = mkOption { | ||
type = types.listOf types.str; | ||
default = []; | ||
description = "List of modules that are always loaded by the initrd."; | ||
type = types.attrNamesToTrue; | ||
default = { }; | ||
description = '' | ||
Set of modules that are always loaded by the initrd. | ||
|
||
${modulesTypeDesc} | ||
''; | ||
apply = mods: lib.attrNames (lib.filterAttrs (_: v: v) mods); | ||
}; | ||
|
||
boot.initrd.includeDefaultModules = mkOption { | ||
|
@@ -223,6 +242,24 @@ in | |
''; | ||
}; | ||
|
||
boot.initrd.allowMissingModules = mkOption { | ||
type = types.bool; | ||
default = false; | ||
description = '' | ||
Whether the initrd can be built even though modules listed in | ||
{option}`boot.initrd.kernelModules` or | ||
{option}`boot.initrd.availableKernelModules` are missing from | ||
the kernel. This is useful when combining configurations that | ||
include a lot of modules, such as | ||
{option}`hardware.enableAllHardware`, with kernels that don't | ||
provide as many modules as typical NixOS kernels. | ||
|
||
Note that enabling this is discouraged. Instead, try disabling | ||
individual modules by setting e.g. | ||
`boot.initrd.availableKernelModules.foo = lib.mkForce false;` | ||
''; | ||
}; | ||
|
||
system.modulesTree = mkOption { | ||
type = types.listOf types.path; | ||
internal = true; | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to tempt contributors into improving this duplicate doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any other types in this file linking to the manual like that?