Jump to content

Linux kernel: Difference between revisions

Modify "Custom kernel commandline" to "Customizing kernel module parameters". Adds a guide for setting modprobe conf settings and clarifies things
imported>Pcboy
m (pkgs.linux_zen.override is incorrect. Should be kernel.override.)
imported>Jmarmstrong1207
(Modify "Custom kernel commandline" to "Customizing kernel module parameters". Adds a guide for setting modprobe conf settings and clarifies things)
Line 60: Line 60:
Note that wireguard has been merged into the mainline kernel, so on newer (21.05+) versions of NixOS with the default kernel wireguard is no longer an option available.
Note that wireguard has been merged into the mainline kernel, so on newer (21.05+) versions of NixOS with the default kernel wireguard is no longer an option available.


=== Custom kernel commandline ===
=== Customizing kernel module parameters ===


The config attribute <code>boot.kernelParams</code> can be set to supply the Linux kernel with additional command line arguments at boot time.
You can use <code>boot.extraModprobeConfig</code>, which is analogous to creating modprobe.conf files in /etc/modprobe.d/ in regular Linux distributions. This can be used for both built-in and loadable kernel modules.
</syntaxHighlight>
<syntaxHighlight lang=nix>
boot.extraModprobeConfig = ''
  # example settings
  options yourmodulename optionA=valueA optionB=valueB # syntax
  options thinkpad_acpi  fan_control=1                # example #1 kernel module parameter
  options usbcore        blinkenlights=1              # example #2 kernel module parameter
'';
</syntaxHighlight>
 
The config attribute <code>boot.kernelParams</code> can be set to supply the Linux kernel with additional command line arguments at boot time. It can only be used for built-in modules.


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
{ pkgs, config, ... }:
{ pkgs, config, ... }:
{
{
   boot.kernelParams = [ /* list of command line arguments */ ];
   boot.kernelParams = [  
    // example settings
    "quiet"
    "splash"
    usbcore.blinkenlights=1 // example kernel module parameter
  ];
}
}
</syntaxHighlight>
</syntaxHighlight>