From a0252d668cacd7df728c099e691aa3482ba664c3 Mon Sep 17 00:00:00 2001 From: Cassie Cheung Date: Wed, 19 Feb 2025 14:38:11 +0800 Subject: [PATCH] apple/t2: add option to select kernel release --- apple/t2/default.nix | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/apple/t2/default.nix b/apple/t2/default.nix index 10793762..d1057caf 100644 --- a/apple/t2/default.nix +++ b/apple/t2/default.nix @@ -1,6 +1,7 @@ { config, lib, pkgs, ... }: let + inherit (lib) types; audioFiles = pkgs.fetchFromGitHub { owner = "kekrby"; repo = "t2-better-audio"; @@ -43,12 +44,25 @@ in ]; options.hardware.apple-t2 = { enableIGPU = lib.mkEnableOption "the usage of the iGPU on specific Apple devices with an AMD dGPU"; + kernelChannel = lib.mkOption { + type = types.enum [ + "stable" + "latest" + ]; + default = "stable"; + example = "latest"; + description = "The kernel release stream to use."; + }; }; config = lib.mkMerge [ { - # For keyboard, touchpad, touchbar and audio. - boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./pkgs/linux-t2 { }); + # Specialized kernel for keyboard, touchpad, touchbar and audio. + boot.kernelPackages = pkgs.linuxPackagesFor ( + pkgs.callPackage ( + if t2Cfg.kernelChannel == "stable" then ./pkgs/linux-t2 else ./pkgs/linux-t2/latest.nix + ) { } + ); boot.initrd.kernelModules = [ "apple-bce" ]; services.udev.packages = [ audioFilesUdevRules ];