move kernel patches

This commit is contained in:
2023-07-15 22:37:43 +08:00
parent 80c55c3a24
commit d5b3506945
4 changed files with 24 additions and 12 deletions

View File

@@ -169,6 +169,7 @@
kernel =
{
cpu = [ "intel" ];
patches = [ "hdmi" "cjktty" ];
};
};}
)

View File

@@ -12,18 +12,8 @@ inputs:
options iwlmvm power_scheme=1
options iwlwifi uapsd_disable=1
'';
boot.kernelPatches =
boot.kernelPatches = inputs.lib.mkAfter
[
{ name = "hdmi"; patch = ./hdmi.patch; }
{
name = "cjktty";
patch = inputs.pkgs.fetchurl
{
url = "https://raw.githubusercontent.com/zhmars/cjktty-patches/master/v6.x/cjktty-6.4.patch";
sha256 = "sha256-oGZxvg6ldpPAn5+W+r/e/WkVO92iv0XVFoJfFF5rdc8=";
};
extraStructuredConfig = { FONT_CJK_16x16 = inputs.lib.kernel.yes; FONT_CJK_32x32 = inputs.lib.kernel.yes; };
}
{
name = "custom config";
patch = null;

View File

@@ -1,8 +1,9 @@
{ pkgs, ... }@inputs:
inputs:
{
options.nixos.kernel = let inherit (inputs.lib) mkOption types; in
{
cpu = mkOption { type = types.listOf (types.enum [ "intel" "amd" ]); default = []; };
patches = mkOption { type = types.listOf (types.enum [ "hdmi" "cjktty" ]); default = []; };
};
config =
{
@@ -10,6 +11,26 @@
{
kernelParams = [ "delayacct" "acpi_osi=Linux" ];
kernelPackages = inputs.pkgs.linuxPackages_xanmod_latest;
kernelPatches =
(
let
patches =
{
"hdmi" = { patch = ./hdmi.patch; };
"cjktty" =
{
patch = inputs.pkgs.fetchurl
{
url = "https://raw.githubusercontent.com/zhmars/cjktty-patches/master/v6.x/cjktty-6.4.patch";
sha256 = "sha256-oGZxvg6ldpPAn5+W+r/e/WkVO92iv0XVFoJfFF5rdc8=";
};
extraStructuredConfig =
{ FONT_CJK_16x16 = inputs.lib.kernel.yes; FONT_CJK_32x32 = inputs.lib.kernel.yes; };
};
};
in
builtins.map (name: { inherit name; } // patches.${name}) inputs.config.nixos.kernel.patches
);
};
hardware.cpu = builtins.listToAttrs (builtins.map
(name: { inherit name; value = { updateMicrocode = true; }; })