diff options
author | Pankaj Raghav <dev@pankajraghav.com> | 2024-06-11 23:21:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-11 23:21:58 +0200 |
commit | 7ce0c7abf814852a2e2831da198e1b44dac7c54f (patch) | |
tree | ed059c3d0d44bba6829455438ea3d7817386a4ca | |
parent | ce1013bc7a32a0b75c6dbfd8d8716165f915fb48 (diff) |
doc: use linuxPackages_custom instead of linuxManualConfig (#319046)
linuxManualConfig involves more boilerplate to change the kernel. Use
the wrapper linuxPackages_custom which is wrapper that takes an
attribute sets and calls linuxManualConfig approrpriately.
This is much easier for beginners to use instead of linuxManualConfig
helper.
Point to linuxManualConfig for further customizations.
-rw-r--r-- | doc/packages/linux.section.md | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/doc/packages/linux.section.md b/doc/packages/linux.section.md index 4c3b2a3b132a..90d14772134b 100644 --- a/doc/packages/linux.section.md +++ b/doc/packages/linux.section.md @@ -40,31 +40,29 @@ pkgs.linux_latest.override { ## Manual kernel configuration {#sec-manual-kernel-configuration} Sometimes it may not be desirable to use kernels built with `pkgs.buildLinux`, especially if most of the common configuration has to be altered or disabled to achieve a kernel as expected by the target use case. -An example of this is building a kernel for use in a VM or micro VM. You can use `pkgs.linuxManualConfig` in these cases. It requires the `src`, `version`, and `configfile` attributes to be specified. +An example of this is building a kernel for use in a VM or micro VM. You can use `pkgs.linuxPackages_custom` in these cases. It requires the `src`, `version`, and `configfile` attributes to be specified. :::{.example #ex-using-linux-manual-config} -# Using `pkgs.linuxManualConfig` with a specific source, version, and config file +# Using `pkgs.linuxPackages_custom` with a specific source, version, and config file ```nix -{ pkgs, ... }: { +{ pkgs, ... }: +pkgs.linuxPackages_custom { version = "6.1.55"; src = pkgs.fetchurl { url = "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-${version}.tar.xz"; hash = "sha256:1h0mzx52q9pvdv7rhnvb8g68i7bnlc9rf8gy9qn4alsxq4g28zm8"; }; configfile = ./path_to_config_file; - linux = pkgs.linuxManualConfig { - inherit version src configfile; - allowImportFromDerivation = true; - }; } ``` If necessary, the version string can be slightly modified to explicitly mark it as a custom version. If you do so, ensure the `modDirVersion` attribute matches the source's version, otherwise the build will fail. ```nix -{ pkgs, ... }: { +{ pkgs, ... }: +pkgs.linuxPackages_custom { version = "6.1.55-custom"; modDirVersion = "6.1.55"; src = pkgs.fetchurl { @@ -72,16 +70,12 @@ If necessary, the version string can be slightly modified to explicitly mark it hash = "sha256:1h0mzx52q9pvdv7rhnvb8g68i7bnlc9rf8gy9qn4alsxq4g28zm8"; }; configfile = ./path_to_config_file; - linux = pkgs.linuxManualConfig { - inherit version modDirVersion src configfile; - allowImportFromDerivation = true; - }; } ``` ::: -Additional attributes can be used with `linuxManualConfig` for further customisation. You're encouraged to read [the `pkgs.linuxManualConfig` source code](https://github.com/NixOS/nixpkgs/blob/d77bda728d5041c1294a68fb25c79e2d161f62b9/pkgs/os-specific/linux/kernel/manual-config.nix) to understand how to use them. +Additional attributes can be used with `linuxManualConfig` for further customisation instead of `linuxPackages_custom`. You're encouraged to read [the `pkgs.linuxManualConfig` source code](https://github.com/NixOS/nixpkgs/blob/d77bda728d5041c1294a68fb25c79e2d161f62b9/pkgs/os-specific/linux/kernel/manual-config.nix) to understand how to use them. To edit the `.config` file for Linux X.Y from within Nix, proceed as follows: |