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 <option>boot.kernelPackages</option>. For instance, this selects the Linux
3.10 kernel: 3.10 kernel:
<programlisting> <programlisting>
<xref linkend="opt-boot.kernelPackages"/> = pkgs.linuxPackages_3_10; <xref linkend="opt-boot.kernelPackages"/> = pkgs.linuxKernel.packages.linux_3_10;
</programlisting> </programlisting>
Note that this not only replaces the kernel, but also packages that are 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 specific to the kernel version, such as the NVIDIA video drivers. This ensures that driver packages are consistent with the kernel.
ensures that driver packages are consistent with the kernel. </para>
</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> <para>
The default Linux kernel configuration should be fine for most users. You can The default Linux kernel configuration should be fine for most users. You can
see the configuration of your current kernel with the following command: 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 linkend="sec-customising-packages" />). For instance, to enable support
for the kernel debugger KGDB: for the kernel debugger KGDB:
<programlisting> <programlisting>
nixpkgs.config.packageOverrides = pkgs: nixpkgs.config.packageOverrides = pkgs: pkgs.lib.recursiveUpdate pkgs {
{ linux_3_4 = pkgs.linux_3_4.override { linuxKernel.kernels.linux_5_10 = pkgs.linuxKernel.kernels.linux_5_10.override {
extraConfig = extraConfig = ''
'' KGDB y
KGDB y '';
'';
};
}; };
};
</programlisting> </programlisting>
<varname>extraConfig</varname> takes a list of Linux kernel configuration <varname>extraConfig</varname> takes a list of Linux kernel configuration
options, one per line. The name of the option should not include the prefix 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 The first step before compiling the kernel is to generate an appropriate
<literal>.config</literal> configuration. Either you pass your own config <literal>.config</literal> configuration. Either you pass your own config
via the <literal>configfile</literal> setting of via the <literal>configfile</literal> setting of
<literal>linuxManualConfig</literal>: <literal>linuxKernel.manualConfig</literal>:
<screen><![CDATA[ <screen><![CDATA[
custom-kernel = super.linuxManualConfig { custom-kernel = let base_kernel = linuxKernel.kernels.linux_4_9;
inherit (super) stdenv hostPlatform; in super.linuxKernel.manualConfig {
inherit (linux_4_9) src; inherit (super) stdenv hostPlatform;
version = "${linux_4_9.version}-custom"; inherit (base_kernel) src;
version = "${base_kernel.version}-custom";
configfile = /home/me/my_kernel_config; configfile = /home/me/my_kernel_config;
allowImportFromDerivation = true; allowImportFromDerivation = true;
}; };
]]></screen> ]]></screen>
You can edit the config with this snippet (by default <command>make You can edit the config with this snippet (by default <command>make