[Boot] Add kernel config option to aviallon namespace

Allows advanced patching / overriding of the kernel while still allowing
to set the kernel in other modules.
This commit is contained in:
Antoine Viallon 2022-11-09 17:26:18 +01:00
parent 3f22bcff49
commit 91c5ba1e69
Signed by: aviallon
GPG key ID: 186FC35EDEB25716
3 changed files with 13 additions and 5 deletions

View file

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }:
{ config, pkgs, lib, options, ... }:
with lib;
let
customKernelPatches = {
@ -81,8 +81,7 @@ let
allowUnfree = (types.isType types.attrs config.nixpkgs.config)
&& (hasAttr "allowUnfree" config.nixpkgs.config)
&& (getAttr "allowUnfree" config.nixpkgs.config);
in
{
in {
options.aviallon.boot = {
enable = mkOption {
@ -130,6 +129,13 @@ in
example = { "i915.fastboot" = true; };
type = types.attrsOf (types.oneOf [ types.bool types.int types.str (types.listOf types.str) ]);
};
kernel = mkOption {
description = "Linux kernel to use";
default = options.boot.kernelPackages.default.kernel;
example = "pkgs.kernel";
type = types.package;
};
};
config = {
@ -158,6 +164,8 @@ in
initrd.kernelModules = [ ];
initrd.availableKernelModules = [ "ehci_pci" ];
kernelPackages = pkgs.linuxPackagesFor cfg.kernel;
kernelPatches = []
++ optional cfg.x32abi.enable customKernelPatches.enableX32ABI
++ optional cfg.rtGroupSched.enable customKernelPatches.enableRTGroupSched