nixos/doc: adjust to the new structure of kernel packages

This commit is contained in:
Dominik Xaver Hörl 2021-06-29 08:28:58 +02:00
parent b4e9cd8596
commit 66fe289724

View file

@ -9,12 +9,14 @@
<option>boot.kernelPackages</option>. For instance, this selects the Linux
3.10 kernel:
<programlisting>
<xref linkend="opt-boot.kernelPackages"/> = pkgs.linuxPackages_3_10;
<xref linkend="opt-boot.kernelPackages"/> = pkgs.linuxKernel.packages.linux_3_10;
</programlisting>
Note that this not only replaces the kernel, but also packages that are
specific to the kernel version, such as the NVIDIA video drivers. This
ensures that driver packages are consistent with the kernel.
</para>
specific to the kernel version, such as the NVIDIA video drivers. This ensures that driver packages are consistent with the kernel.
</para>
<para>
While <varname>pkgs.linuxKernel.packages</varname> contains all available kernel packages, you may want to use one of the unversioned <varname>pkgs.linuxPackages_*</varname> aliases such as <varname>pkgs.linuxPackages_latest</varname>, that are kept up to date with new versions.
</para>
<para>
The default Linux kernel configuration should be fine for most users. You can
see the configuration of your current kernel with the following command:
@ -27,14 +29,13 @@ zcat /proc/config.gz
linkend="sec-customising-packages" />). For instance, to enable support
for the kernel debugger KGDB:
<programlisting>
nixpkgs.config.packageOverrides = pkgs:
{ linux_3_4 = pkgs.linux_3_4.override {
extraConfig =
''
KGDB y
'';
};
nixpkgs.config.packageOverrides = pkgs: pkgs.lib.recursiveUpdate pkgs {
linuxKernel.kernels.linux_5_10 = pkgs.linuxKernel.kernels.linux_5_10.override {
extraConfig = ''
KGDB y
'';
};
};
</programlisting>
<varname>extraConfig</varname> takes a list of Linux kernel configuration
options, one per line. The name of the option should not include the prefix
@ -73,15 +74,16 @@ nixpkgs.config.packageOverrides = pkgs:
The first step before compiling the kernel is to generate an appropriate
<literal>.config</literal> configuration. Either you pass your own config
via the <literal>configfile</literal> setting of
<literal>linuxManualConfig</literal>:
<literal>linuxKernel.manualConfig</literal>:
<screen><![CDATA[
custom-kernel = super.linuxManualConfig {
inherit (super) stdenv hostPlatform;
inherit (linux_4_9) src;
version = "${linux_4_9.version}-custom";
custom-kernel = let base_kernel = linuxKernel.kernels.linux_4_9;
in super.linuxKernel.manualConfig {
inherit (super) stdenv hostPlatform;
inherit (base_kernel) src;
version = "${base_kernel.version}-custom";
configfile = /home/me/my_kernel_config;
allowImportFromDerivation = true;
configfile = /home/me/my_kernel_config;
allowImportFromDerivation = true;
};
]]></screen>
You can edit the config with this snippet (by default <command>make