apple/t2: add option to select kernel release

This commit is contained in:
Cassie Cheung
2025-02-19 14:38:11 +08:00
committed by mergify[bot]
parent d098b09500
commit a0252d668c

View File

@@ -1,6 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
inherit (lib) types;
audioFiles = pkgs.fetchFromGitHub { audioFiles = pkgs.fetchFromGitHub {
owner = "kekrby"; owner = "kekrby";
repo = "t2-better-audio"; repo = "t2-better-audio";
@@ -43,12 +44,25 @@ in
]; ];
options.hardware.apple-t2 = { options.hardware.apple-t2 = {
enableIGPU = lib.mkEnableOption "the usage of the iGPU on specific Apple devices with an AMD dGPU"; 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 [ config = lib.mkMerge [
{ {
# For keyboard, touchpad, touchbar and audio. # Specialized kernel for keyboard, touchpad, touchbar and audio.
boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./pkgs/linux-t2 { }); 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" ]; boot.initrd.kernelModules = [ "apple-bce" ];
services.udev.packages = [ audioFilesUdevRules ]; services.udev.packages = [ audioFilesUdevRules ];