nixos: make it easy to apply kernel patches
This makes it easy to specify kernel patches:
boot.kernelPatches = [ pkgs.kernelPatches.ubuntu_fan_4_4 ];
To make the `boot.kernelPatches` option possible, this also makes it
easy to extend and/or modify the kernel packages within a linuxPackages
set. For example:
pkgs.linuxPackages.extend (self: super: {
kernel = super.kernel.override {
kernelPatches = super.kernel.kernelPatches ++ [
pkgs.kernelPatches.ubuntu_fan_4_4
];
};
});
Closes #15095
This commit is contained in:
@@ -4,7 +4,9 @@ with lib;
|
||||
|
||||
let
|
||||
|
||||
kernel = config.boot.kernelPackages.kernel;
|
||||
inherit (config.boot) kernelPatches;
|
||||
|
||||
inherit (config.boot.kernelPackages) kernel;
|
||||
|
||||
kernelModulesConf = pkgs.writeText "nixos.conf"
|
||||
''
|
||||
@@ -21,6 +23,11 @@ in
|
||||
|
||||
boot.kernelPackages = mkOption {
|
||||
default = pkgs.linuxPackages;
|
||||
apply = kernelPackages: kernelPackages.extend (self: super: {
|
||||
kernel = super.kernel.override {
|
||||
kernelPatches = super.kernel.kernelPatches ++ kernelPatches;
|
||||
};
|
||||
});
|
||||
# We don't want to evaluate all of linuxPackages for the manual
|
||||
# - some of it might not even evaluate correctly.
|
||||
defaultText = "pkgs.linuxPackages";
|
||||
@@ -39,6 +46,13 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
boot.kernelPatches = mkOption {
|
||||
type = types.listOf types.attrs;
|
||||
default = [];
|
||||
example = literalExample "[ pkgs.kernelPatches.ubuntu_fan_4_4 ]";
|
||||
description = "A list of additional patches to apply to the kernel.";
|
||||
};
|
||||
|
||||
boot.kernelParams = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
|
||||
Reference in New Issue
Block a user