2023-12-25 16:57:09 -05:00
|
|
|
{ lib, buildLinux, fetchFromGitHub, fetchzip, runCommand
|
|
|
|
, ... } @ args:
|
2022-08-25 11:17:01 -04:00
|
|
|
|
|
|
|
let
|
|
|
|
patchRepo = fetchFromGitHub {
|
|
|
|
owner = "t2linux";
|
|
|
|
repo = "linux-t2-patches";
|
2024-06-20 17:15:06 -04:00
|
|
|
rev = "0ad2b3913f5484ba8e86b6965f5d88903464261d";
|
|
|
|
hash = "sha256-mwT4cuIBrz3tz8+fAxVKmnRtkPRp3lWmNbocuXCsm44=";
|
2022-08-25 11:17:01 -04:00
|
|
|
};
|
|
|
|
|
2024-06-20 17:15:06 -04:00
|
|
|
version = "6.9.4";
|
2022-08-25 11:17:01 -04:00
|
|
|
majorVersion = with lib; (elemAt (take 1 (splitVersion version)) 0);
|
|
|
|
in
|
|
|
|
buildLinux (args // {
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
pname = "linux-t2";
|
|
|
|
# Snippet from nixpkgs
|
|
|
|
modDirVersion = with lib; "${concatStringsSep "." (take 3 (splitVersion "${version}.0"))}";
|
|
|
|
|
2023-12-25 16:57:09 -05:00
|
|
|
src = runCommand "patched-source" {} ''
|
|
|
|
cp -r ${fetchzip {
|
|
|
|
url = "mirror://kernel/linux/kernel/v${majorVersion}.x/linux-${version}.tar.xz";
|
2024-06-20 17:15:06 -04:00
|
|
|
hash = "sha256-8jC5DpPi6poig1gmJPIIZ2HMwQQt1kTK4PcvyYm+Hsg=";
|
2023-12-25 16:57:09 -05:00
|
|
|
}} $out
|
|
|
|
chmod -R u+w $out
|
|
|
|
cd $out
|
|
|
|
while read -r patch; do
|
|
|
|
echo "Applying patch $patch";
|
|
|
|
patch -p1 < $patch;
|
|
|
|
done < <(find ${patchRepo} -type f -name "*.patch" | sort)
|
|
|
|
'';
|
2022-08-25 11:17:01 -04:00
|
|
|
|
|
|
|
structuredExtraConfig = with lib.kernel; {
|
|
|
|
APPLE_BCE = module;
|
|
|
|
APPLE_GMUX = module;
|
2024-06-09 10:48:25 -04:00
|
|
|
APFS_FS = module;
|
2022-08-25 11:17:01 -04:00
|
|
|
BRCMFMAC = module;
|
|
|
|
BT_BCM = module;
|
|
|
|
BT_HCIBCM4377 = module;
|
|
|
|
BT_HCIUART_BCM = yes;
|
|
|
|
BT_HCIUART = module;
|
2024-04-12 15:53:47 -04:00
|
|
|
HID_APPLETB_BL = module;
|
|
|
|
HID_APPLETB_KBD = module;
|
2022-08-25 11:17:01 -04:00
|
|
|
HID_APPLE = module;
|
2024-04-12 15:53:47 -04:00
|
|
|
DRM_APPLETBDRM = module;
|
2022-08-25 11:17:01 -04:00
|
|
|
HID_APPLE_MAGIC_BACKLIGHT = module;
|
|
|
|
HID_SENSOR_ALS = module;
|
|
|
|
SND_PCM = module;
|
|
|
|
STAGING = yes;
|
|
|
|
};
|
|
|
|
|
2023-12-25 16:57:09 -05:00
|
|
|
kernelPatches = [];
|
2022-08-25 11:17:01 -04:00
|
|
|
} // (args.argsOverride or {}))
|