Compare commits

..
29 changed files with 68 additions and 572 deletions

No files matched your search

+1 -1
View File
@@ -9,5 +9,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
- uses: cachix/install-nix-action@v30
- run: nix run ./tests#run .
-3
View File
@@ -231,7 +231,6 @@ See code for all available configurations.
| [Lenovo ThinkPad A475](lenovo/thinkpad/a475) | `<nixos-hardware/lenovo/thinkpad/a475>` |
| [Lenovo ThinkPad E14 (AMD)](lenovo/thinkpad/e14/amd) | `<nixos-hardware/lenovo/thinkpad/e14/amd>` |
| [Lenovo ThinkPad E14 (Intel)](lenovo/thinkpad/e14/intel) | `<nixos-hardware/lenovo/thinkpad/e14/intel>` |
| [Lenovo ThinkPad E15 (Intel)](lenovo/thinkpad/e15/intel) | `<nixos-hardware/lenovo/thinkpad/e15/intel>` |
| [Lenovo ThinkPad E470](lenovo/thinkpad/e470) | `<nixos-hardware/lenovo/thinkpad/e470>` |
| [Lenovo ThinkPad E495](lenovo/thinkpad/e495) | `<nixos-hardware/lenovo/thinkpad/e495>` |
| [Lenovo ThinkPad L13 Yoga](lenovo/thinkpad/l13/yoga) | `<nixos-hardware/lenovo/thinkpad/l13/yoga>` |
@@ -245,7 +244,6 @@ See code for all available configurations.
| [Lenovo ThinkPad P14s AMD Gen 3](lenovo/thinkpad/p14s/amd/gen3) | `<nixos-hardware/lenovo/thinkpad/p14s/amd/gen3>` |
| [Lenovo ThinkPad P14s AMD Gen 4](lenovo/thinkpad/p14s/amd/gen4) | `<nixos-hardware/lenovo/thinkpad/p14s/amd/gen4>` |
| [Lenovo ThinkPad P14s Intel Gen 3](lenovo/thinkpad/p14s/intel/gen3) | `<nixos-hardware/lenovo/thinkpad/p14s/intel/gen3>` |
| [Lenovo ThinkPad P14s Intel Gen 5](lenovo/thinkpad/p14s/intel/gen5) | `<nixos-hardware/lenovo/thinkpad/p14s/intel/gen5>` |
| [Lenovo ThinkPad P16s AMD Gen 1](lenovo/thinkpad/p16s/amd/gen1) | `<nixos-hardware/lenovo/thinkpad/p16s/amd/gen1>` |
| [Lenovo ThinkPad P16s AMD Gen 2](lenovo/thinkpad/p16s/amd/gen2) | `<nixos-hardware/lenovo/thinkpad/p16s/amd/gen2>` |
| [Lenovo ThinkPad P1](lenovo/thinkpad/p1) | `<nixos-hardware/lenovo/thinkpad/p1>` |
@@ -376,7 +374,6 @@ See code for all available configurations.
| [Tuxedo InfinityBook v4](tuxedo/infinitybook/v4) | `<nixos-hardware/tuxedo/infinitybook/v4>` |
| [TUXEDO Aura 15 - Gen1](tuxedo/aura/15/gen1) | `<nixos-hardware/tuxedo/aura/15/gen1>` |
| [TUXEDO InfinityBook Pro 14 - Gen7](tuxedo/infinitybook/pro14/gen7) | `<nixos-hardware/tuxedo/infinitybook/pro14/gen7>` |
| [TUXEDO InfinityBook Pro 14 - Gen9 - INTEL](tuxedo/infinitybook/pro14/gen9-intel) | `<nixos-hardware/tuxedo/infinitybook/pro14/gen9-intel>` |
| [TUXEDO Pulse 14 - Gen3](tuxedo/pulse/14/gen3) | `<nixos-hardware/tuxedo/pulse/14/gen3>` |
| [TUXEDO Pulse 15 - Gen2](tuxedo/pulse/15/gen2) | `<nixos-hardware/tuxedo/pulse/15/gen2>` |
| [Xiaomi Redmibook 16 Pro 2024](xiaomi/redmibook/16-pro-2024) | `<nixos-hardware/xiaomi/redmibook/16-pro-2024>` |
+2 -28
View File
@@ -7,8 +7,6 @@
let
inherit (lib) types;
nixosVersion = lib.versions.majorMinor lib.version;
audioFiles = pkgs.fetchFromGitHub {
owner = "kekrby";
repo = "t2-better-audio";
@@ -63,19 +61,6 @@ in
example = "latest";
description = "The kernel release stream to use.";
};
firmware = {
enable = lib.mkEnableOption "automatic and declarative Wi-Fi and Bluetooth firmware configuration";
version = lib.mkOption {
type = types.enum [
"monterey"
"ventura"
"sonoma"
];
default = "sonoma";
example = "ventura";
description = "The macOS version to use.";
};
};
};
config = lib.mkMerge [
@@ -97,6 +82,8 @@ in
"iommu=pt"
];
hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/";
services.pipewire.package = pipewirePackage;
services.pipewire.wireplumber.package = pkgs.wireplumber.override {
pipewire = pipewirePackage;
@@ -105,24 +92,11 @@ in
# Make sure post-resume.service exists
powerManagement.enable = true;
}
(if lib.versionAtLeast nixosVersion "25.05" then {
services.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/";
} else {
hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/";
})
(lib.mkIf t2Cfg.enableIGPU {
# Enable the iGPU by default if present
environment.etc."modprobe.d/apple-gmux.conf".text = ''
options apple-gmux force_igd=y
'';
})
(lib.mkIf t2Cfg.firmware.enable {
# Configure Wi-Fi and Bluetooth firmware
hardware.firmware = [
(pkgs.callPackage ./pkgs/brcm-firmware { version = t2Cfg.firmware.version; })
];
})
];
}
-89
View File
@@ -1,89 +0,0 @@
{
lib,
stdenvNoCC,
callPackage,
vmTools,
util-linux,
linux,
kmod,
version,
}:
let
get-firmware = callPackage ./get-firmware.nix { };
fetchmacos = callPackage ./fetchmacos.nix { };
# See https://github.com/kholia/OSX-KVM/blob/master/fetch-macOS-v2.py#L534-L546.
# Versions before macOS Monterey don't have Bluetooth firmware.
# Whereas macOS Sequoia doesn't have firmware for MacBook Air 2018 and 2019.
boards = {
monterey = {
boardId = "Mac-B809C3757DA9BB8D";
mlb = "00000000000000000";
osType = "latest";
hash = "sha256-My8FLnqHZn+THfGPIhTSApW/kIWM0ZZhjBxWujhhWPM=";
};
ventura = {
boardId = "Mac-4B682C642B45593E";
mlb = "00000000000000000";
osType = "latest";
hash = "sha256-Qy9Whu8pqHo+m6wHnCIqURAR53LYQKc0r87g9eHgnS4=";
};
sonoma = {
boardId = "Mac-827FAC58A8FDFA22";
mlb = "00000000000000000";
osType = "default";
hash = "sha256-phlpwNTYhugqX2KGljqxpbfGtCFDgggQPzB7U29XSmM=";
};
};
in
vmTools.runInLinuxVM (
stdenvNoCC.mkDerivation {
pname = "brcm-firmware";
inherit version;
src = fetchmacos {
name = version;
inherit (boards.${version})
boardId
mlb
osType
hash
;
};
dontUnpack = true;
nativeBuildInputs = [
util-linux
get-firmware
];
buildPhase = ''
ln -s ${linux}/lib /lib
${kmod}/bin/modprobe loop
${kmod}/bin/modprobe hfsplus
imgdir=$(mktemp -d)
loopdev=$(losetup -f | cut -d "/" -f 3)
losetup -P $loopdev $src
loopdev_partition=/dev/$(lsblk -o KNAME,TYPE,MOUNTPOINT -n | grep $loopdev | tail -1 | awk '{print $1}')
mount $loopdev_partition $imgdir
get-bluetooth $imgdir/usr/share/firmware/bluetooth bluetooth/
get-wifi $imgdir/usr/share/firmware/wifi wifi/
'';
installPhase = ''
mkdir -p $out/lib/firmware/brcm
cp bluetooth/brcm/* $out/lib/firmware/brcm/
cp wifi/brcm/* $out/lib/firmware/brcm/
'';
meta = with lib; {
description = "Wi-Fi and Bluetooth firmware for T2 Macs";
license = licenses.unfree;
maintainers = with maintainers; [ mkorje ];
platforms = platforms.linux;
};
}
)
@@ -1,42 +0,0 @@
{
lib,
stdenvNoCC,
fetchFromGitHub,
callPackage,
dmg2img,
}:
let
macrecovery = callPackage ./macrecovery.nix { };
in
{
name,
boardId,
mlb,
osType,
hash,
}:
stdenvNoCC.mkDerivation {
name = name;
dontUnpack = true;
nativeBuildInputs = [
macrecovery
dmg2img
];
buildPhase = ''
macrecovery download -o . -b ${boardId} -m ${mlb} -os ${osType}
dmg2img -s BaseSystem.dmg fw.img
'';
installPhase = ''
cp fw.img $out
'';
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = hash;
}
@@ -1,133 +0,0 @@
diff --git a/asahi_firmware/bluetooth.py b/asahi_firmware/bluetooth.py
index 0934225..3eaa442 100644
--- a/asahi_firmware/bluetooth.py
+++ b/asahi_firmware/bluetooth.py
@@ -1,8 +1,25 @@
+#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
import logging, os, os.path, re, sys
from collections import namedtuple, defaultdict
+from hashlib import sha256
-from .core import FWFile
+class FWFile(object):
+ def __init__(self, name, data):
+ self.name = name
+ self.data = data
+ self.sha = sha256(data).hexdigest()
+
+ def __repr__(self):
+ return f"FWFile({self.name!r}, <{self.sha[:16]}>)"
+
+ def __eq__(self, other):
+ if other is None:
+ return False
+ return self.sha == other.sha
+
+ def __hash__(self):
+ return hash(self.sha)
log = logging.getLogger("asahi_firmware.bluetooth")
@@ -127,16 +144,16 @@ class BluetoothFWCollection(object):
if __name__ == "__main__":
col = BluetoothFWCollection(sys.argv[1])
-
- if len(sys.argv) > 2:
- from . import FWPackage
-
- pkg = FWPackage(sys.argv[2])
- pkg.add_files(sorted(col.files()))
- pkg.close()
-
- for i in pkg.manifest:
- print(i)
- else:
- for name, fwfile in col.files():
- print(name, f"{fwfile.name} ({len(fwfile.data)} bytes)")
+
+ dir = os.path.join(sys.argv[2], "brcm")
+ os.makedirs(dir)
+
+ hashes = {}
+ for name, data in sorted(col.files()):
+ path = os.path.join(sys.argv[2], name)
+ if data.sha in hashes:
+ os.link(hashes[data.sha], path)
+ else:
+ with open(path, "wb") as f:
+ f.write(data.data)
+ hashes[data.sha] = path
diff --git a/asahi_firmware/wifi.py b/asahi_firmware/wifi.py
index 346965c..261aa32 100644
--- a/asahi_firmware/wifi.py
+++ b/asahi_firmware/wifi.py
@@ -1,6 +1,24 @@
+#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
import sys, os, os.path, pprint, statistics, logging
-from .core import FWFile
+from hashlib import sha256
+
+class FWFile(object):
+ def __init__(self, name, data):
+ self.name = name
+ self.data = data
+ self.sha = sha256(data).hexdigest()
+
+ def __repr__(self):
+ return f"FWFile({self.name!r}, <{self.sha[:16]}>)"
+
+ def __eq__(self, other):
+ if other is None:
+ return False
+ return self.sha == other.sha
+
+ def __hash__(self):
+ return hash(self.sha)
log = logging.getLogger("asahi_firmware.wifi")
@@ -40,7 +58,9 @@ class WiFiFWCollection(object):
self.prune()
def load(self, source_path):
+ included_folders = ["C-4355__s-C1", "C-4364__s-B2", "C-4364__s-B3", "C-4377__s-B3"]
for dirpath, dirnames, filenames in os.walk(source_path):
+ dirnames[:] = [d for d in dirnames if d in included_folders]
if "perf" in dirnames:
dirnames.remove("perf")
if "assert" in dirnames:
@@ -141,18 +161,16 @@ class WiFiFWCollection(object):
if __name__ == "__main__":
col = WiFiFWCollection(sys.argv[1])
- if len(sys.argv) > 2:
- from .core import FWPackage
-
- pkg = FWPackage(sys.argv[2])
- pkg.add_files(sorted(col.files()))
- pkg.close()
-
- for i in pkg.manifest:
- print(i)
- else:
- for name, fwfile in col.files():
- if isinstance(fwfile, str):
- print(name, "->", fwfile)
- else:
- print(name, f"({len(fwfile.data)} bytes)")
+
+ dir = os.path.join(sys.argv[2], "brcm")
+ os.makedirs(dir)
+
+ hashes = {}
+ for name, data in sorted(col.files()):
+ path = os.path.join(sys.argv[2], name)
+ if data.sha in hashes:
+ os.link(hashes[data.sha], path)
+ else:
+ with open(path, "wb") as f:
+ f.write(data.data)
+ hashes[data.sha] = path
@@ -1,35 +0,0 @@
{
lib,
stdenvNoCC,
fetchFromGitHub,
python3,
}:
stdenvNoCC.mkDerivation {
name = "get-firmware";
src = fetchFromGitHub {
owner = "AsahiLinux";
repo = "asahi-installer";
rev = "v0.7.9";
hash = "sha256-vbhepoZ52k5tW2Gd7tfQTZ5CLqzhV7dUcVh6+AYwECk=";
};
patches = [ ./get-firmware-standalone.patch ];
buildInputs = [ python3 ];
installPhase = ''
cd asahi_firmware
install -Dm755 bluetooth.py $out/bin/get-bluetooth
install -Dm755 wifi.py $out/bin/get-wifi
'';
meta = with lib; {
description = "Patched Asahi Linux Installer scripts to get brcm firmware";
homepage = "https://github.com/AsahiLinux/asahi-installer";
license = licenses.mit;
maintainers = with maintainers; [ mkorje ];
platforms = platforms.all;
};
}
@@ -1,36 +0,0 @@
{
lib,
stdenvNoCC,
fetchFromGitHub,
python3,
}:
stdenvNoCC.mkDerivation {
name = "macrecovery";
src = fetchFromGitHub {
owner = "acidanthera";
repo = "OpenCorePkg";
rev = "1.0.4";
hash = "sha256-5Eypza9teSJSulHaK7Sxh562cTKedXKn3y+Z3+fC6sM=";
};
buildInputs = [ python3 ];
installPhase = ''
cd Utilities/macrecovery
install -Dm755 macrecovery.py $out/opt/macrecovery
cp boards.json $out/opt/boards.json
mkdir $out/bin
ln -s $out/opt/macrecovery $out/bin/macrecovery
'';
meta = with lib; {
description = "A tool that helps to automate recovery interaction";
homepage = "https://github.com/acidanthera/OpenCorePkg";
license = licenses.bsd3;
maintainers = with maintainers; [ mkorje ];
mainProgram = "macrecovery";
platforms = platforms.all;
};
}
-1
View File
@@ -40,7 +40,6 @@ kernel.override (
HID_APPLETB_BL = module;
HID_APPLETB_KBD = module;
HID_APPLE = module;
HID_MAGICMOUSE = module;
DRM_APPLETBDRM = module;
HID_SENSOR_ALS = module;
SND_PCM = module;
+11 -19
View File
@@ -1,5 +1,5 @@
{
"base_url": "https://raw.githubusercontent.com/t2linux/linux-t2-patches/4109f2144b626097a34b21def849a5d8cbcf3f7c/",
"base_url": "https://raw.githubusercontent.com/t2linux/linux-t2-patches/73bbcb413e8c9294c27ec9b53f84d8b19ecd3f05/",
"patches": [
{
"name": "1001-Add-apple-bce-driver.patch",
@@ -38,12 +38,16 @@
"hash": "sha256-TJjXAlQ4WEROnq/xd6/4JHTuEJjqT7dLLcE4etKdzc0="
},
{
"name": "1014-drm-format-helper-Add-conversion-from-XRGB8888-to-BG.patch",
"hash": "sha256-Ky19+cCiYDaHBh2o5IhZO8J1ExDT7o8K9cgPz+AL8Cg="
"name": "1012-lib-vsprintf-Add-support-for-generic-FOURCCs-by-exte.patch",
"hash": "sha256-cMl4WJcT/nM/z12LEsnLxssQgnRqKE+d/P2uMr5PUDQ="
},
{
"name": "1014-drm-format-helper-add-helper-for-BGR888-to-XRGB8888-.patch",
"hash": "sha256-iBM2z+/jZb/3+c9wHjC7W359oRl+DzFDZ1KL5eUc3qo="
},
{
"name": "1015-drm-tiny-add-driver-for-Apple-Touch-Bars-in-x86-Macs.patch",
"hash": "sha256-zFeDJeoM/XS+Ds3DBLEcv4JbUhlEk9z4rHQ4t6XaghA="
"hash": "sha256-sTb+ruY6W18wz9XRJzZKlfl4a8fGo1nrtCoOYNaPAjI="
},
{
"name": "2008-i915-4-lane-quirk-for-mbp15-1.patch",
@@ -90,20 +94,8 @@
"hash": "sha256-skYKmLsJ6O42/wINLccZWoKS0XhVlC1Nfxi1Ekloxns="
},
{
"name": "4001-asahi-trackpad.patch",
"hash": "sha256-NOuGgUxDQEfFPlij/EnhWmgqeG3/l+j+r2T1YJG7raY="
},
{
"name": "4002-HID-quirks-remove-T2-devices-from-hid_mouse_ignore_l.patch",
"hash": "sha256-DdUo4/4254VD+MzEaLI3opSS0Z7+UwsitJaS2lAlpI8="
},
{
"name": "4003-HID-apple-ignore-the-trackpad-on-T2-Macs.patch",
"hash": "sha256-PZpdvPKvVsLsg3vx3jmq3QCapBUcUVE35N37usBRb6g="
},
{
"name": "4004-HID-magicmouse-Add-support-for-trackpads-found-on-T2.patch",
"hash": "sha256-pmGR0JdMMwGWG3zwMwMBuSyzltLvvzjTgfi1Ii1cglk="
"name": "4001-Input-bcm5974-Add-support-for-the-T2-Macs.patch",
"hash": "sha256-CaviinY3rYqQh+/DGyeBTzLL/ZfIvguOQlWCs3KN4zc="
},
{
"name": "7001-drm-i915-fbdev-Discard-BIOS-framebuffers-exceeding-h.patch",
@@ -111,7 +103,7 @@
},
{
"name": "8001-Add-APFS-driver.patch",
"hash": "sha256-T0ZmO99nmnpNVLjlzMRc7wrkBON7w2F6HaPk4pQVV7A="
"hash": "sha256-40Gl8eR9RB6qEoU+vY7+sVWms8e566OUmAb9LZWZK3w="
},
{
"name": "8002-Necessary-modifications-to-build-APFS-with-the-kerne.patch",
+11 -19
View File
@@ -1,5 +1,5 @@
{
"base_url": "https://raw.githubusercontent.com/t2linux/linux-t2-patches/dd2e78d234fc289d3ebadf1852d761498e668a02/",
"base_url": "https://raw.githubusercontent.com/t2linux/linux-t2-patches/19c29ff4bbda9f512b7b69d63d249de269dc66ab/",
"patches": [
{
"name": "1001-Add-apple-bce-driver.patch",
@@ -38,12 +38,16 @@
"hash": "sha256-TJjXAlQ4WEROnq/xd6/4JHTuEJjqT7dLLcE4etKdzc0="
},
{
"name": "1014-drm-format-helper-Add-conversion-from-XRGB8888-to-BG.patch",
"hash": "sha256-Ky19+cCiYDaHBh2o5IhZO8J1ExDT7o8K9cgPz+AL8Cg="
"name": "1012-lib-vsprintf-Add-support-for-generic-FOURCCs-by-exte.patch",
"hash": "sha256-cMl4WJcT/nM/z12LEsnLxssQgnRqKE+d/P2uMr5PUDQ="
},
{
"name": "1014-drm-format-helper-add-helper-for-BGR888-to-XRGB8888-.patch",
"hash": "sha256-iBM2z+/jZb/3+c9wHjC7W359oRl+DzFDZ1KL5eUc3qo="
},
{
"name": "1015-drm-tiny-add-driver-for-Apple-Touch-Bars-in-x86-Macs.patch",
"hash": "sha256-zFeDJeoM/XS+Ds3DBLEcv4JbUhlEk9z4rHQ4t6XaghA="
"hash": "sha256-sTb+ruY6W18wz9XRJzZKlfl4a8fGo1nrtCoOYNaPAjI="
},
{
"name": "2008-i915-4-lane-quirk-for-mbp15-1.patch",
@@ -90,20 +94,8 @@
"hash": "sha256-skYKmLsJ6O42/wINLccZWoKS0XhVlC1Nfxi1Ekloxns="
},
{
"name": "4001-asahi-trackpad.patch",
"hash": "sha256-NOuGgUxDQEfFPlij/EnhWmgqeG3/l+j+r2T1YJG7raY="
},
{
"name": "4002-HID-quirks-remove-T2-devices-from-hid_mouse_ignore_l.patch",
"hash": "sha256-DdUo4/4254VD+MzEaLI3opSS0Z7+UwsitJaS2lAlpI8="
},
{
"name": "4003-HID-apple-ignore-the-trackpad-on-T2-Macs.patch",
"hash": "sha256-PZpdvPKvVsLsg3vx3jmq3QCapBUcUVE35N37usBRb6g="
},
{
"name": "4004-HID-magicmouse-Add-support-for-trackpads-found-on-T2.patch",
"hash": "sha256-pmGR0JdMMwGWG3zwMwMBuSyzltLvvzjTgfi1Ii1cglk="
"name": "4001-Input-bcm5974-Add-support-for-the-T2-Macs.patch",
"hash": "sha256-CaviinY3rYqQh+/DGyeBTzLL/ZfIvguOQlWCs3KN4zc="
},
{
"name": "7001-drm-i915-fbdev-Discard-BIOS-framebuffers-exceeding-h.patch",
@@ -111,7 +103,7 @@
},
{
"name": "8001-Add-APFS-driver.patch",
"hash": "sha256-xjB7lqE4bweUvDa6Tx6LurxWlUlX4nUN+DbTRQb5bQI="
"hash": "sha256-RjEhzCqGvwRSGFjMgg1Z1kFwbxB9VT3SkVKoOdtDvP0="
},
{
"name": "8002-Necessary-modifications-to-build-APFS-with-the-kerne.patch",
+1 -1
View File
@@ -2,7 +2,7 @@
{
imports = [
../../../common/cpu/intel/lunar-lake
../../../common/cpu/intel
../../../common/pc/laptop
../../../common/pc/laptop/ssd
];
-3
View File
@@ -174,7 +174,6 @@
lenovo-thinkpad-a475 = import ./lenovo/thinkpad/a475;
lenovo-thinkpad-e14-amd = import ./lenovo/thinkpad/e14/amd;
lenovo-thinkpad-e14-intel = import ./lenovo/thinkpad/e14/intel;
lenovo-thinkpad-e15-intel = import ./lenovo/thinkpad/e15/intel;
lenovo-thinkpad-e470 = import ./lenovo/thinkpad/e470;
lenovo-thinkpad-e495 = import ./lenovo/thinkpad/e495;
lenovo-thinkpad-l13 = import ./lenovo/thinkpad/l13;
@@ -189,7 +188,6 @@
lenovo-thinkpad-p14s-amd-gen3 = import ./lenovo/thinkpad/p14s/amd/gen3;
lenovo-thinkpad-p14s-amd-gen4 = import ./lenovo/thinkpad/p14s/amd/gen4;
lenovo-thinkpad-p14s-intel-gen3 = import ./lenovo/thinkpad/p14s/intel/gen3;
lenovo-thinkpad-p14s-intel-gen5 = import ./lenovo/thinkpad/p14s/intel/gen5;
lenovo-thinkpad-p16s-amd-gen1 = import ./lenovo/thinkpad/p16s/amd/gen1;
lenovo-thinkpad-p16s-amd-gen2 = import ./lenovo/thinkpad/p16s/amd/gen2;
lenovo-thinkpad-p50 = import ./lenovo/thinkpad/p50;
@@ -329,7 +327,6 @@
tuxedo-aura-15-gen1 = import ./tuxedo/aura/15/gen1;
tuxedo-infinitybook-v4 = import ./tuxedo/infinitybook/v4;
tuxedo-infinitybook-pro14-gen7 = import ./tuxedo/infinitybook/pro14/gen7;
tuxedo-infinitybook-pro14-gen9-intel = import ./tuxedo/infinitybook/pro14/gen9-intel;
tuxedo-pulse-14-gen3 = import ./tuxedo/pulse/14/gen3;
tuxedo-pulse-15-gen2 = import ./tuxedo/pulse/15/gen2;
xiaomi-redmibook-16-pro-2024 = import ./xiaomi/redmibook/16-pro-2024;
+2 -3
View File
@@ -9,10 +9,9 @@ Symptoms:
- It goes into suspend, then seems to boot and hang. Sometimes it suspends successfully, but waking it from suspend puts it in the "zombie" state.
- By playing chicken with volatile storage and flicking the power switch on the back of power supply, you can sometimes get it to wake from suspend as the card un-powers before volatile storage does.
This can be fixed by disabling GPP0 and GPP8 (And, for some cards, potentially PTXH, I can't test) in /proc/acpi/wakeup.
Fix: disable GPP0 and GPP8 (And, for some cards, potentially PTXH, I can't test) in /proc/acpi/wakeup
- To do this permanently, a systemd service is provided
But because /proc/acpi/wakeup only supports toggling (not disabling) wakeups, we use a udev rule to disable wakeups for
the same device by PCI device ID instead.
## This affects at least:
- Gigabyte b550m-d3sh (my machine)
+33 -11
View File
@@ -1,13 +1,35 @@
{ pkgs, lib, ... } :
{
# Work around an issue causing the system to unsuspend immediately after suspend
# and/or hang after suspend.
#
# See https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ksbm0mb/ /u/Demotay
#
# Most suggestions elsewhere are to disable GPP0 and/or GPP8 using /proc/acpi/wakeup, but that is
# inconvenient because it toggles. This does essentially the same thing using udev, which can set
# the wakeup attribute to a specific value.
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x1022", ATTR{device}=="0x1483", ATTR{power/wakeup}="disabled"
'';
systemd.services.bugfixSuspend-GPP0 = {
enable = lib.mkDefault true;
description = "Fix crash on wakeup from suspend/hibernate (b550 bugfix)";
unitConfig = {
Type = "oneshot";
};
serviceConfig = {
User = "root"; # root may not be necessary
# check for gppN, disable if enabled
# lifted from https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ksbm0mb/ /u/Demotay
ExecStart = "-${pkgs.bash}/bin/bash -c 'if grep 'GPP0' /proc/acpi/wakeup | grep -q 'enabled'; then echo 'GPP0' > /proc/acpi/wakeup; fi'";
RemainAfterExit = "yes"; # required to not toggle when `nixos-rebuild switch` is ran
};
wantedBy = ["multi-user.target"];
};
systemd.services.bugfixSuspend-GPP8 = {
enable = lib.mkDefault true;
description = "Fix crash on wakeup from suspend/hibernate (b550 bugfix)";
unitConfig = {
Type = "oneshot";
};
serviceConfig = {
User = "root";
ExecStart = "-${pkgs.bash}/bin/bash -c 'if grep 'GPP8' /proc/acpi/wakeup | grep -q 'enabled'; then echo 'GPP8' > /proc/acpi/wakeup; fi'";
RemainAfterExit = "yes";
};
wantedBy = ["multi-user.target"];
};
}
+3 -3
View File
@@ -7,13 +7,13 @@
stdenv.mkDerivation (finalAttr: {
pname = "bmi260";
version = "1.1.0";
version = "1.0.0";
src = fetchFromGitHub {
owner = "hhd-dev";
repo = finalAttr.pname;
rev = "v${finalAttr.version}";
hash = "sha256-So8rWDTXYsMUgLBU9WrJp47txA8dI98tcxXNy92AYgg=";
hash = "sha256-EFous0pPpCuVoCsFz6/4NryQRSH9Jw9Qng+RY1hiX1c=";
};
hardeningDisable = [ "pic" ];
@@ -38,6 +38,6 @@ stdenv.mkDerivation (finalAttr: {
gpl2Only
];
maintainers = with maintainers; [ Cryolitia ];
platforms = [ "x86_64-linux" ];
platforms = platforms.linux;
};
})
-45
View File
@@ -1,45 +0,0 @@
# Lenovo Thinkpad E15
This is tested on an [E15 Gen4](https://psref.lenovo.com/WDProduct/ThinkPad/ThinkPad_E15_Gen_4_Intel).
## Tested Hardware
```bash
lspci -nn
00:00.0 Host bridge [0600]: Intel Corporation Alder Lake-U15 Host and DRAM Controller [8086:4601] (rev 04)
00:02.0 VGA compatible controller [0300]: Intel Corporation Alder Lake-UP3 GT2 [Iris Xe Graphics] [8086:46a8] (rev 0c)
00:04.0 Signal processing controller [1180]: Intel Corporation Alder Lake Innovation Platform Framework Processor Participant [8086:461d] (rev 04)
00:06.0 PCI bridge [0604]: Intel Corporation 12th Gen Core Processor PCI Express x4 Controller #0 [8086:464d] (rev 04)
00:07.0 PCI bridge [0604]: Intel Corporation Alder Lake-P Thunderbolt 4 PCI Express Root Port #0 [8086:466e] (rev 04)
00:08.0 System peripheral [0880]: Intel Corporation 12th Gen Core Processor Gaussian & Neural Accelerator [8086:464f] (rev 04)
00:0a.0 Signal processing controller [1180]: Intel Corporation Platform Monitoring Technology [8086:467d] (rev 01)
00:0d.0 USB controller [0c03]: Intel Corporation Alder Lake-P Thunderbolt 4 USB Controller [8086:461e] (rev 04)
00:0d.2 USB controller [0c03]: Intel Corporation Alder Lake-P Thunderbolt 4 NHI #0 [8086:463e] (rev 04)
00:0d.3 USB controller [0c03]: Intel Corporation Alder Lake-P Thunderbolt 4 NHI #1 [8086:466d] (rev 04)
00:14.0 USB controller [0c03]: Intel Corporation Alder Lake PCH USB 3.2 xHCI Host Controller [8086:51ed] (rev 01)
00:14.2 RAM memory [0500]: Intel Corporation Alder Lake PCH Shared SRAM [8086:51ef] (rev 01)
00:14.3 Network controller [0280]: Intel Corporation Alder Lake-P PCH CNVi WiFi [8086:51f0] (rev 01)
00:15.0 Serial bus controller [0c80]: Intel Corporation Alder Lake PCH Serial IO I2C Controller #0 [8086:51e8] (rev 01)
00:15.2 Serial bus controller [0c80]: Intel Corporation Alder Lake PCH Serial IO I2C Controller #2 [8086:51ea] (rev 01)
00:16.0 Communication controller [0780]: Intel Corporation Alder Lake PCH HECI Controller [8086:51e0] (rev 01)
00:1f.0 ISA bridge [0601]: Intel Corporation Alder Lake PCH eSPI Controller [8086:5182] (rev 01)
00:1f.3 Multimedia audio controller [0401]: Intel Corporation Alder Lake PCH-P High Definition Audio Controller [8086:51c8] (rev 01)
00:1f.4 SMBus [0c05]: Intel Corporation Alder Lake PCH-P SMBus Host Controller [8086:51a3] (rev 01)
00:1f.5 Serial bus controller [0c80]: Intel Corporation Alder Lake-P PCH SPI Controller [8086:51a4] (rev 01)
00:1f.6 Ethernet controller [0200]: Intel Corporation Ethernet Connection (16) I219-V [8086:1a1f] (rev 01)
01:00.0 Non-Volatile memory controller [0108]: Sandisk Corp WD PC SN740 NVMe SSD 512GB (DRAM-less) [15b7:5016] (rev 01)
```
## Updating Firmware
First enable `fwupd` in your config
```nix
services.fwupd.enable = true;
```
Then run
```bash
$ fwupdmgr update
```
-15
View File
@@ -1,15 +0,0 @@
{ ... }:
{
imports = [
../.
../../../common/pc/laptop
../../../common/pc/laptop/ssd
];
boot.kernelParams = [
# Force use of the thinkpad_acpi driver for backlight control.
# This allows the backlight save/load systemd service to work.
"acpi_backlight=native"
];
}
-10
View File
@@ -1,10 +0,0 @@
{ lib, ... }:
{
imports = [
../.
../../../../common/cpu/intel/alder-lake
];
services.throttled.enable = lib.mkDefault true;
}
@@ -1,19 +0,0 @@
{ lib, pkgs, ... }:
{
imports = [
../.
../../../../../common/gpu/nvidia/prime.nix
../../../../../common/gpu/nvidia/turing
];
hardware = {
intelgpu.driver = "i915"; #xe driver may be used on newer kernels
nvidia = {
prime = {
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
};
}
-2
View File
@@ -5,6 +5,4 @@
];
services.xserver.wacom.enable = lib.mkDefault config.services.xserver.enable;
services.hardware.bolt.enable = lib.mkDefault true;
}
@@ -7,14 +7,14 @@ let
cfg = config.microsoft-surface;
version = "6.12.19";
version = "6.12.17";
kernelPatches = surfacePatches {
inherit version;
patchFn = ./patches.nix;
};
kernelPackages = linuxPackage {
inherit version kernelPatches;
sha256 = "sha256-1zvwV77ARDSxadG2FkGTb30Ml865I6KB8y413U3MZTE=";
sha256 = "sha256-XCBc00+Al05Jc+MhywCPX2iVqKqMJXfwapRIzXfeY7M=";
ignoreConfigErrors=true;
};
-8
View File
@@ -12,11 +12,3 @@ firmware.
Alternatively, starting from the _Tow-Boot_ disk image on eMMC is easier to
deal with and understand than having to deal with _U-Boot_ manually.
## Console
To configure default console I/O to use serial instead of HDMI (default):
```nix
hardware.rockpro64.console = "serial";
```
-17
View File
@@ -1,17 +0,0 @@
{ config, lib, ... }:
{
options.hardware.rockpro64.console = lib.mkOption {
default = "hdmi";
description = "Default console to use at boot.";
type = lib.types.enum [
"hdmi"
"serial"
];
};
config = lib.mkIf (config.hardware.rockpro64.console == "hdmi") {
boot.kernelParams = [
"console=ttyS0"
"console=tty0"
];
};
}
-7
View File
@@ -1,17 +1,10 @@
{ lib, ... }:
{
imports = [
./console.nix
];
boot.initrd.kernelModules = [
# PCIe/NVMe
"nvme"
"pcie_rockchip_host"
"phy_rockchip_pcie"
# Network
"dwmac_rk"
# HDMI
"rockchipdrm"
];
# control the fan on the rockpro64 (like the one in the NAS case)
hardware.fancontrol = {
-12
View File
@@ -1,12 +0,0 @@
{ lib, options, ... }:
{
imports = [
../../common/pc/laptop
../../common/pc/ssd
];
# Enable TUXEDO's kernel drivers if they are available
hardware = lib.optionalAttrs (options.hardware ? tuxedo-drivers) {
tuxedo-drivers.enable = lib.mkDefault true;
};
}
+2 -1
View File
@@ -2,8 +2,9 @@
{
imports = [
../../.
../../../../common/cpu/intel
../../../../common/pc/laptop
../../../../common/pc/ssd
];
# Cooling management
@@ -1 +0,0 @@
# [TUXEDO InfinityBook Pro 14 - Gen9 - INTEL](https://www.tuxedocomputers.com/en/TUXEDO-InfinityBook-Pro-14-Gen9-INTEL)
@@ -1,6 +0,0 @@
{
imports = [
../../.
../../../../common/cpu/intel
];
}