nixos/modules/kernel/default.nix

52 lines
1.6 KiB
Nix
Raw Normal View History

2023-07-15 22:37:43 +08:00
inputs:
2023-07-14 17:10:53 +08:00
{
options.nixos.kernel = let inherit (inputs.lib) mkOption types; in
{
cpu = mkOption { type = types.listOf (types.enum [ "intel" "amd" ]); default = []; };
2023-07-15 22:37:43 +08:00
patches = mkOption { type = types.listOf (types.enum [ "hdmi" "cjktty" ]); default = []; };
2023-07-14 17:10:53 +08:00
};
config =
{
2023-07-15 22:12:29 +08:00
boot =
{
kernelParams = [ "delayacct" "acpi_osi=Linux" ];
2023-07-16 14:29:26 +08:00
kernelPackages = inputs.pkgs.linuxPackagesFor (inputs.pkgs.linuxPackages_xanmod.kernel.override rec
2023-07-16 14:23:48 +08:00
{
2023-07-16 14:29:26 +08:00
src = inputs.pkgs.fetchFromGitHub
2023-07-16 14:23:48 +08:00
{
2023-07-16 14:29:26 +08:00
owner = "xanmod";
repo = "linux";
rev = modDirVersion;
sha256 = "sha256-ab4AQx1ApJ9o1oqgNoJBL64tI0qpyVBm5XUC8l1yT6Q=";
2023-07-16 14:23:48 +08:00
};
2023-07-16 14:29:26 +08:00
version = "6.3.12";
modDirVersion = "6.3.12-xanmod1";
2023-07-16 14:37:55 +08:00
stdenv = inputs.pkgs.ccacheStdenv.override { stdenv = inputs.pkgs.linuxPackages_xanmod.kernel.stdenv; };
2023-07-16 14:23:48 +08:00
});
2023-07-15 22:37:43 +08:00
kernelPatches =
(
let
patches =
{
"hdmi" = { patch = ./hdmi.patch; };
"cjktty" =
{
patch = inputs.pkgs.fetchurl
{
2023-07-16 14:23:48 +08:00
url = "https://raw.githubusercontent.com/zhmars/cjktty-patches/master/v6.x/cjktty-6.3.patch";
sha256 = "sha256-QnsWruzhtiZnqzTUXkPk9Hb19Iddr4VTWXyV4r+iLvE=";
2023-07-15 22:37:43 +08:00
};
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
);
2023-07-15 22:12:29 +08:00
};
2023-07-14 17:10:53 +08:00
hardware.cpu = builtins.listToAttrs (builtins.map
(name: { inherit name; value = { updateMicrocode = true; }; })
inputs.config.nixos.kernel.cpu);
};
}