Skip to content

Commit 3608d7f

Browse files
committed
feat: add possibility to add kernel patches
Signed-off-by: Fabian Wienand <fabian.wienand@9elements.com>
1 parent f67deb8 commit 3608d7f

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ You can use this flake as a base for your own NixOS image or configuration.
7777
version = "6.6.7";
7878
sha256 = "...";
7979
extraKernelModules = [ "dummy" "loop" ];
80+
kernelPatches = [
81+
{
82+
name = "my-custom-patch";
83+
patch = ./path/to/my-patch.patch;
84+
}
85+
];
8086
};
8187
};
8288
in {
@@ -124,6 +130,7 @@ You can override these options in your own configuration or flake:
124130
| `sha256` | `str` | SRI hash | SHA256 hash for the kernel tarball (must be in SRI format, e.g. `sha256-...`). |
125131
| `extraKernelModules` | `list of str` | `[]` | Extra kernel modules to load at boot (e.g. `["dummy"]`). |
126132
| `includeIntelModules` | `bool` | `true` | Include Intel-specific kernel modules (rapl, pmc, lpss). |
133+
| `kernelPatches` | `list of attrs` | `[]` | List of kernel patches to apply. Each patch should have `name` and `patch` attributes. |
127134

128135
---
129136

modules/kernel.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ in
2828
default = true;
2929
description = "Intel-specific kernel modules (rapl, pmc, lpss).";
3030
};
31+
32+
kernelPatches = lib.mkOption {
33+
type = lib.types.listOf lib.types.attrs;
34+
default = [ ];
35+
description = "List of kernel patches to apply. Each patch should have 'name' and 'patch' attributes.";
36+
example = lib.literalExpression ''[
37+
{
38+
name = "my-patch";
39+
patch = ./my-patch.patch;
40+
}
41+
]'';
42+
};
3143
};
3244

3345
config = {
@@ -39,6 +51,7 @@ in
3951
url = "mirror://kernel/linux/kernel/v${lib.versions.major version}.x/linux-${version}.tar.xz";
4052
sha256 = cfg.sha256;
4153
};
54+
kernelPatches = cfg.kernelPatches;
4255
};
4356
});
4457

0 commit comments

Comments
 (0)