Rebase to flake parts #7
This commit is contained in:
@@ -74,11 +74,6 @@
|
||||
gpuPassthrough.enable = false;
|
||||
};
|
||||
|
||||
remoteDesktop = {
|
||||
enable = false;
|
||||
moonlight.enable = false;
|
||||
sunshine.enable = false;
|
||||
};
|
||||
audio.enable = true;
|
||||
docker.enable = true;
|
||||
gaming.enable = true;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{ pkgs, ... }: {
|
||||
# Apple T2 machines often need additional Broadcom firmware not shipped in
|
||||
# linux-firmware. Firmware is stored in this host directory.
|
||||
hardware.firmware = [
|
||||
(pkgs.stdenvNoCC.mkDerivation (final: {
|
||||
name = "t2mbp-brcm-firmware";
|
||||
src = ./firmware/brcm;
|
||||
installPhase = ''
|
||||
mkdir -p "$out/lib/firmware/brcm"
|
||||
cp -v ${final.src}/* "$out/lib/firmware/brcm"
|
||||
'';
|
||||
}))
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{ ... }: {
|
||||
# Bootloader and EFI
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
boot.loader.efi.efiSysMountPoint = "/boot";
|
||||
boot.loader.systemd-boot.configurationLimit = 5;
|
||||
|
||||
# Hibernate support (resume from swap partition).
|
||||
boot.resumeDevice = "/dev/disk/by-uuid/403c9698-b501-4198-96cf-f27f82f1eb1a";
|
||||
|
||||
# Suspend is allowed again: kernel cmdline + out-of-tree apple-bce are in
|
||||
# `t2linux/_private/boot-tuning.nix` and `t2linux/_private/kernel.nix`. If you need
|
||||
# to block sleep while debugging: `systemd.sleep.settings.Sleep.AllowSuspend = "no";`
|
||||
|
||||
# Power and thermal management.
|
||||
powerManagement.cpuFreqGovernor = "ondemand";
|
||||
services.thermald.enable = true;
|
||||
hardware.sensor.iio.enable = true;
|
||||
|
||||
|
||||
|
||||
# Pull in linux-firmware (and friends) from nixpkgs.
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
hardware.enableAllFirmware = true;
|
||||
|
||||
# Enable flakes and the newer CLI.
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
system.stateVersion = "25.11";
|
||||
}
|
||||
@@ -98,11 +98,6 @@
|
||||
};
|
||||
|
||||
chiasson.system = {
|
||||
remoteDesktop = {
|
||||
enable = false;
|
||||
moonlight.enable = false;
|
||||
sunshine.enable = false;
|
||||
};
|
||||
audio.enable = true;
|
||||
extraPackages = [ pkgs.sops ];
|
||||
networking = {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
{ ... }: {
|
||||
# T2: align with https://github.com/deqrocks/apple-bce#required-kernel-parameters (suspend stack).
|
||||
# (Older t2linux guidance used s2idle + pcie_ports=compat; deqrocks fork expects deep + auto + pm_async=off.)
|
||||
boot.kernelParams = [
|
||||
"mem_sleep_default=deep"
|
||||
"intel_iommu=on"
|
||||
"iommu=pt"
|
||||
"pcie_ports=auto"
|
||||
"pm_async=off"
|
||||
# https://wiki.t2linux.org/guides/hybrid-graphics/#enabling-the-igpu — helps some post-suspend black screens.
|
||||
"i915.enable_guc=3"
|
||||
];
|
||||
|
||||
# Hybrid T2 Macs: prefer Intel for display/GL (saves power; avoids broken AMDGPU after resume).
|
||||
# https://wiki.t2linux.org/guides/hybrid-graphics/
|
||||
boot.extraModprobeConfig = ''
|
||||
options apple-gmux force_igd=y
|
||||
'';
|
||||
|
||||
# If the AMD dGPU misbehaves after S3 (Electron apps won’t start, suspend breaks), keep it unloaded.
|
||||
# See https://github.com/deqrocks/apple-bce#notes-for-dgpu-models — drop this list if you need DRI_PRIME
|
||||
# or external displays wired through the dGPU.
|
||||
boot.blacklistedKernelModules = [ "amdgpu" ];
|
||||
|
||||
boot.kernelModules = [ "apple-bce" ];
|
||||
boot.initrd.availableKernelModules = [ "apple-bce" ];
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{ lib, pkgs, inputs, config, ... }:
|
||||
let
|
||||
# Two-stage callPackage matches nixos-hardware apple/t2 generic.nix.
|
||||
linuxT2GenericFromDir =
|
||||
{ lib, ... }@args:
|
||||
{ kernel, t2linuxPatchesSrc }:
|
||||
let
|
||||
patchNames = lib.sort lib.lessThan (
|
||||
lib.filter (n: builtins.match "^[0-9]{4}-.*\\.patch$" n != null) (
|
||||
lib.attrNames (builtins.readDir t2linuxPatchesSrc)
|
||||
)
|
||||
);
|
||||
t2Patches = map
|
||||
(name: {
|
||||
inherit name;
|
||||
patch = "${t2linuxPatchesSrc}/${name}";
|
||||
})
|
||||
patchNames;
|
||||
in
|
||||
kernel.override (
|
||||
args
|
||||
// {
|
||||
pname = "linux-t2";
|
||||
structuredExtraConfig = with lib.kernel; {
|
||||
# In-tree staging driver disabled; we ship deqrocks/apple-bce via boot.extraModulePackages.
|
||||
APPLE_BCE = no;
|
||||
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 = t2Patches ++ (args.kernelPatches or [ ]);
|
||||
argsOverride.extraMeta = {
|
||||
description = "The Linux kernel (with patches from the T2 Linux project)";
|
||||
maintainers = with lib.maintainers; [ soopyc ];
|
||||
};
|
||||
}
|
||||
// (args.argsOverride or { })
|
||||
);
|
||||
|
||||
linuxT2Kernel = (pkgs.callPackage linuxT2GenericFromDir { }) {
|
||||
kernel = pkgs.linux_6_19;
|
||||
t2linuxPatchesSrc = inputs.t2linux-patches;
|
||||
};
|
||||
in
|
||||
{
|
||||
boot.kernelPackages = lib.mkForce (pkgs.linuxPackagesFor linuxT2Kernel);
|
||||
|
||||
# https://github.com/deqrocks/apple-bce (branch no-state-suspend) — BCE + suspend-oriented fixes.
|
||||
# README also mentions companion userspace: t2-upower, t2-kbd-tb (not packaged here yet).
|
||||
boot.extraModulePackages = [
|
||||
(config.boot.kernelPackages.callPackage ./apple-bce.nix { })
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{ ... }: {
|
||||
flake.nixosModules.t2linux = {
|
||||
imports = [
|
||||
./_private/kernel.nix
|
||||
./_private/boot-tuning.nix
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user