Files
nixos-hardware/apple/t2/pkgs/linux-t2/generic.nix
T
Sophie Cheung 701eb9f269 apple/t2: pin kernel releases; upgrade version and patches
disconnect kernel versions from nixpkgs, which should avoid breaking users'
config when nixpkgs has a new version and some patches are incompatible,
and when a PR updating the patches are still waiting to be merged, like
in #2027.

Signed-off-by: Sophie Cheung <git@soopy.moe>
2026-10-07 20:05:18 +08:00

71 lines
1.5 KiB
Nix

{
lib,
fetchurl, # fetchpatch does unnecessary normalization
buildLinux,
linuxKernel,
...
}@args:
patchesFile:
let
inherit (builtins) readFile fromJSON;
patchset = fromJSON (readFile patchesFile);
t2-patches = map (
{ name, hash }:
{
inherit name;
patch = fetchurl {
inherit name hash;
url = patchset.base_url + name;
};
}
) patchset.patches;
in
buildLinux (
{
pname = "linux-t2";
version = patchset.kernel.version;
src = fetchurl {
inherit (patchset.kernel) url hash;
};
structuredExtraConfig = with lib.kernel; {
APPLE_BCE = module;
APPLE_GMUX = module;
APFS_FS = module;
BRCMFMAC = module;
BT_BCM = module;
BT_HCIBCM4377 = module;
BT_HCIUART_BCM = yes;
BT_HCIUART = module;
HID_APPLETB_BL = module;
HID_APPLETB_KBD = module;
HID_APPLE = module;
HID_MAGICMOUSE = module;
DRM_APPLETBDRM = module;
HID_SENSOR_ALS = module;
SND_PCM = module;
STAGING = yes;
};
kernelPatches = [
# include default patches for good measure
linuxKernel.kernelPatches.request_key_helper
linuxKernel.kernelPatches.bridge_stp_helper
]
++ t2-patches
++ (args.kernelPatches or [ ]);
extraMeta = {
description = "The Linux kernel (with patches from the T2 Linux project)";
# take responsibility for the downstream kernel
maintainers = with lib.maintainers; [ soopyc ];
};
}
// (args.argsOverride or { })
)