From f9fbbd15c3219bce06b4812160377cc6c27550cc Mon Sep 17 00:00:00 2001 From: Alex Kraker Date: Mon, 8 Jun 2026 11:47:27 -0500 Subject: [PATCH 01/24] Add support for ThinkPad Gen 5 Nvidia Add support for ThinkPad Gen 5 with optional Nvidia GPU. This gen uses _ampere_ microarchitecture, so we import that module. We set defaults for the Intel and Nvidia hardware bus ID's based on my own system which is this hardware configuration. --- README.md | 1 + flake.nix | 1 + lenovo/thinkpad/p1/gen5/nvidia/default.nix | 24 ++++++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 lenovo/thinkpad/p1/gen5/nvidia/default.nix diff --git a/README.md b/README.md index 5a73142f..767f2447 100644 --- a/README.md +++ b/README.md @@ -305,6 +305,7 @@ See code for all available configurations. | [Lenovo ThinkPad L14 (Intel)](lenovo/thinkpad/l14/intel) | `` | `lenovo-thinkpad-l14-intel` | | [Lenovo ThinkPad L480](lenovo/thinkpad/l480) | `` | `lenovo-thinkpad-l480` | | [Lenovo ThinkPad P1 Gen 3](lenovo/thinkpad/p1/3th-gen) | `` | `lenovo-thinkpad-p1-gen3` | +| [Lenovo ThinkPad P1 Gen 5 (Nvidia)](lenovo/thinkpad/p1/gen5/nvidia) | `` | `lenovo-thinkpad-p1-gen5-nvidia` | | [Lenovo ThinkPad P14s AMD Gen 1](lenovo/thinkpad/p14s/amd/gen1) | `` | `lenovo-thinkpad-p14s-amd-gen1` | | [Lenovo ThinkPad P14s AMD Gen 2](lenovo/thinkpad/p14s/amd/gen2) | `` | `lenovo-thinkpad-p14s-amd-gen2` | | [Lenovo ThinkPad P14s AMD Gen 3](lenovo/thinkpad/p14s/amd/gen3) | `` | `lenovo-thinkpad-p14s-amd-gen3` | diff --git a/flake.nix b/flake.nix index 599eca42..7e8c69fc 100644 --- a/flake.nix +++ b/flake.nix @@ -262,6 +262,7 @@ lenovo-thinkpad-l480 = import ./lenovo/thinkpad/l480; lenovo-thinkpad-p1 = import ./lenovo/thinkpad/p1; lenovo-thinkpad-p1-gen3 = import ./lenovo/thinkpad/p1/3th-gen; + lenovo-thinkpad-p1-gen5-nvidia = import ./lenovo/thinkpad/p1/gen5/nvidia; lenovo-thinkpad-p14s-amd-gen1 = import ./lenovo/thinkpad/p14s/amd/gen1; lenovo-thinkpad-p14s-amd-gen2 = import ./lenovo/thinkpad/p14s/amd/gen2; lenovo-thinkpad-p14s-amd-gen3 = import ./lenovo/thinkpad/p14s/amd/gen3; diff --git a/lenovo/thinkpad/p1/gen5/nvidia/default.nix b/lenovo/thinkpad/p1/gen5/nvidia/default.nix new file mode 100644 index 00000000..387e5e57 --- /dev/null +++ b/lenovo/thinkpad/p1/gen5/nvidia/default.nix @@ -0,0 +1,24 @@ +{ lib, ... }: +{ + imports = [ + ../../. + ../../../../../common/gpu/nvidia/ampere + ../../../../../common/gpu/nvidia/prime.nix + ]; + + hardware = { + graphics = { + enable = lib.mkDefault true; + enable32Bit = lib.mkDefault true; + }; + nvidia = { + modesetting.enable = lib.mkDefault true; + prime = { + # Bus ID of the Intel GPU. + intelBusId = lib.mkDefault "PCI:0:2:0"; + # Bus ID of the NVIDIA GPU. + nvidiaBusId = lib.mkDefault "PCI:1:0:0"; + }; + }; + }; +} From d35f12f89598943d289ef1666b00efa3fa1e19db Mon Sep 17 00:00:00 2001 From: Alex Kraker Date: Mon, 8 Jun 2026 12:17:25 -0500 Subject: [PATCH 02/24] Add ThinkPad P1 Gen 5 base Add support for P1 Gen 5 intel cpu architecture at `lenovo/thinkpad/p1/gen5`. The `gen5/nvidia` opt-in GPU imports from there. Add p1-gen5 to flake and README. --- README.md | 1 + flake.nix | 1 + lenovo/thinkpad/p1/default.nix | 3 --- lenovo/thinkpad/p1/gen5/default.nix | 7 +++++++ lenovo/thinkpad/p1/gen5/nvidia/default.nix | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 lenovo/thinkpad/p1/gen5/default.nix diff --git a/README.md b/README.md index 767f2447..f0f19931 100644 --- a/README.md +++ b/README.md @@ -305,6 +305,7 @@ See code for all available configurations. | [Lenovo ThinkPad L14 (Intel)](lenovo/thinkpad/l14/intel) | `` | `lenovo-thinkpad-l14-intel` | | [Lenovo ThinkPad L480](lenovo/thinkpad/l480) | `` | `lenovo-thinkpad-l480` | | [Lenovo ThinkPad P1 Gen 3](lenovo/thinkpad/p1/3th-gen) | `` | `lenovo-thinkpad-p1-gen3` | +| [Lenovo ThinkPad P1 Gen 5](lenovo/thinkpad/p1/gen5) | `` | `lenovo-thinkpad-p1-gen5` | | [Lenovo ThinkPad P1 Gen 5 (Nvidia)](lenovo/thinkpad/p1/gen5/nvidia) | `` | `lenovo-thinkpad-p1-gen5-nvidia` | | [Lenovo ThinkPad P14s AMD Gen 1](lenovo/thinkpad/p14s/amd/gen1) | `` | `lenovo-thinkpad-p14s-amd-gen1` | | [Lenovo ThinkPad P14s AMD Gen 2](lenovo/thinkpad/p14s/amd/gen2) | `` | `lenovo-thinkpad-p14s-amd-gen2` | diff --git a/flake.nix b/flake.nix index 7e8c69fc..2addcf36 100644 --- a/flake.nix +++ b/flake.nix @@ -262,6 +262,7 @@ lenovo-thinkpad-l480 = import ./lenovo/thinkpad/l480; lenovo-thinkpad-p1 = import ./lenovo/thinkpad/p1; lenovo-thinkpad-p1-gen3 = import ./lenovo/thinkpad/p1/3th-gen; + lenovo-thinkpad-p1-gen5 = import ./lenovo/thinkpad/p1/gen5; lenovo-thinkpad-p1-gen5-nvidia = import ./lenovo/thinkpad/p1/gen5/nvidia; lenovo-thinkpad-p14s-amd-gen1 = import ./lenovo/thinkpad/p14s/amd/gen1; lenovo-thinkpad-p14s-amd-gen2 = import ./lenovo/thinkpad/p14s/amd/gen2; diff --git a/lenovo/thinkpad/p1/default.nix b/lenovo/thinkpad/p1/default.nix index 197bfab2..75c0abee 100644 --- a/lenovo/thinkpad/p1/default.nix +++ b/lenovo/thinkpad/p1/default.nix @@ -1,9 +1,6 @@ { imports = [ ../../../common/cpu/intel - # might need nvidia module but we don't know the PCI ids: - # https://github.com/NixOS/nixos-hardware/pull/274#discussion_r650483740 - #../../../common/gpu/nvidia/prime.nix ../../../common/pc/ssd ]; diff --git a/lenovo/thinkpad/p1/gen5/default.nix b/lenovo/thinkpad/p1/gen5/default.nix new file mode 100644 index 00000000..1c9661fc --- /dev/null +++ b/lenovo/thinkpad/p1/gen5/default.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + imports = [ + ../. + ../../../../common/cpu/intel/alder-lake # P1 Gen 5 is 12th-gen Alder Lake + ]; +} diff --git a/lenovo/thinkpad/p1/gen5/nvidia/default.nix b/lenovo/thinkpad/p1/gen5/nvidia/default.nix index 387e5e57..7c866edb 100644 --- a/lenovo/thinkpad/p1/gen5/nvidia/default.nix +++ b/lenovo/thinkpad/p1/gen5/nvidia/default.nix @@ -1,7 +1,7 @@ { lib, ... }: { imports = [ - ../../. + ../. ../../../../../common/gpu/nvidia/ampere ../../../../../common/gpu/nvidia/prime.nix ]; From 0e5b1ce394ab00eb04d90f728ea742319d6abb4c Mon Sep 17 00:00:00 2001 From: Alex Kraker Date: Mon, 8 Jun 2026 12:27:13 -0500 Subject: [PATCH 03/24] Add P1 Gen 5 module README --- lenovo/thinkpad/p1/gen5/README.md | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 lenovo/thinkpad/p1/gen5/README.md diff --git a/lenovo/thinkpad/p1/gen5/README.md b/lenovo/thinkpad/p1/gen5/README.md new file mode 100644 index 00000000..78fbad2a --- /dev/null +++ b/lenovo/thinkpad/p1/gen5/README.md @@ -0,0 +1,55 @@ +# Lenovo ThinkPad P1 Gen 5 + +https://www.lenovo.com/us/en/p/laptops/thinkpad/thinkpadp/thinkpad-p1-gen-5-16-inch-intel/len101t0033 + +Tested on a P1 Gen 5 with Intel Iris Xe (Alder Lake) graphics and an +NVIDIA GeForce RTX 3080 Ti Mobile (Ampere) discrete GPU. + +- `lenovo-thinkpad-p1-gen5` — Alder Lake base; use on iGPU-only units. +- `lenovo-thinkpad-p1-gen5-nvidia` — adds NVIDIA PRIME **offload**. Run a + program on the discrete GPU with `nvidia-offload `. + +## Tested Hardware + +```shell +lspci -nn +00:00.0 Host bridge [0600]: Intel Corporation 12th Gen Core Processor Host Bridge/DRAM Registers [8086:4641] (rev 02) +00:01.0 PCI bridge [0604]: Intel Corporation 12th Gen Core Processor PCI Express x16 Controller #1 [8086:460d] (rev 02) +00:02.0 VGA compatible controller [0300]: Intel Corporation Alder Lake-P GT2 [Iris Xe Graphics] [8086:46a6] (rev 0c) +00:04.0 Signal processing controller [1180]: Intel Corporation Alder Lake Innovation Platform Framework Processor Participant [8086:461d] (rev 02) +00:06.0 PCI bridge [0604]: Intel Corporation 12th Gen Core Processor PCI Express x4 Controller #0 [8086:464d] (rev 02) +00:08.0 System peripheral [0880]: Intel Corporation 12th Gen Core Processor Gaussian & Neural Accelerator [8086:464f] (rev 02) +00:0a.0 Signal processing controller [1180]: Intel Corporation Platform Monitoring Technology [8086:467d] (rev 01) +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:16.0 Communication controller [0780]: Intel Corporation Alder Lake PCH HECI Controller [8086:51e0] (rev 01) +00:16.3 Serial controller [0700]: Intel Corporation Alder Lake AMT SOL Redirection [8086:51e3] (rev 01) +00:1c.0 PCI bridge [0604]: Intel Corporation Device [8086:51b8] (rev 01) +00:1c.7 PCI bridge [0604]: Intel Corporation Alder Lake PCH-P PCI Express Root Port #9 [8086:51bf] (rev 01) +00:1d.0 PCI bridge [0604]: Intel Corporation Alder Lake PCI Express Root Port #9 [8086:51b0] (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) +01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA103M [GeForce RTX 3080 Ti Mobile] [10de:2420] (rev a1) +01:00.1 Audio device [0403]: NVIDIA Corporation Device [10de:2288] (rev a1) +04:00.0 Non-Volatile memory controller [0108]: SK hynix Gold P31/BC711/PC711 NVMe Solid State Drive [1c5c:174a] +0a:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5261 PCIe SD Express Card Reader controller [10ec:5261] (rev 01) +20:00.0 PCI bridge [0604]: Intel Corporation Thunderbolt 4 Bridge [Maple Ridge 4C 2020] [8086:1136] (rev 02) +21:00.0 PCI bridge [0604]: Intel Corporation Thunderbolt 4 Bridge [Maple Ridge 4C 2020] [8086:1136] (rev 02) +21:01.0 PCI bridge [0604]: Intel Corporation Thunderbolt 4 Bridge [Maple Ridge 4C 2020] [8086:1136] (rev 02) +21:02.0 PCI bridge [0604]: Intel Corporation Thunderbolt 4 Bridge [Maple Ridge 4C 2020] [8086:1136] (rev 02) +21:03.0 PCI bridge [0604]: Intel Corporation Thunderbolt 4 Bridge [Maple Ridge 4C 2020] [8086:1136] (rev 02) +22:00.0 USB controller [0c03]: Intel Corporation Thunderbolt 4 NHI [Maple Ridge 4C 2020] [8086:1137] +56:00.0 USB controller [0c03]: Intel Corporation Thunderbolt 4 USB Controller [Maple Ridge 4C 2020] [8086:1138] + +nix-info -m + - system: `"x86_64-linux"` + - host os: `Linux 7.0.11, NixOS, 26.05 (Yarara), 26.05.20260603.6b31628` + - multi-user?: `yes` + - sandbox: `yes` + - version: `nix-env (Nix) 2.34.7` + - nixpkgs: `/nix/store/snzg7swkp0vsd2qch9izsbmxnyb13ca0-source` +``` From d765d66fd5a6faf7b095063a6b0f80077407bdf6 Mon Sep 17 00:00:00 2001 From: Alex Kraker Date: Mon, 8 Jun 2026 13:55:50 -0500 Subject: [PATCH 04/24] lenovo/thinkpad/p1: document finegrained power management in gen5 readme --- lenovo/thinkpad/p1/gen5/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lenovo/thinkpad/p1/gen5/README.md b/lenovo/thinkpad/p1/gen5/README.md index 78fbad2a..41d2aaf4 100644 --- a/lenovo/thinkpad/p1/gen5/README.md +++ b/lenovo/thinkpad/p1/gen5/README.md @@ -9,6 +9,19 @@ NVIDIA GeForce RTX 3080 Ti Mobile (Ampere) discrete GPU. - `lenovo-thinkpad-p1-gen5-nvidia` — adds NVIDIA PRIME **offload**. Run a program on the discrete GPU with `nvidia-offload `. +## Power management + +The `-nvidia` profile enables PRIME **offload** but does not turn on fine-grained +runtime power management, so the discrete GPU stays powered even when idle — +noticeable battery drain on a laptop. That setting is experimental and depends on +the GPU + firmware supporting PCIe Runtime D3 (RTD3), so it is left to the user. +If your unit supports it, let the dGPU suspend when unused by adding to your own +configuration: + +```nix +hardware.nvidia.powerManagement.finegrained = true; +``` + ## Tested Hardware ```shell From d9e50dd040292f387747a03ceaf55e9b80e5bae7 Mon Sep 17 00:00:00 2001 From: Alex Kraker Date: Mon, 8 Jun 2026 20:15:12 -0500 Subject: [PATCH 05/24] Add note about Wayland KMS requirement --- lenovo/thinkpad/p1/gen5/nvidia/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lenovo/thinkpad/p1/gen5/nvidia/default.nix b/lenovo/thinkpad/p1/gen5/nvidia/default.nix index 7c866edb..4b588292 100644 --- a/lenovo/thinkpad/p1/gen5/nvidia/default.nix +++ b/lenovo/thinkpad/p1/gen5/nvidia/default.nix @@ -12,6 +12,8 @@ enable32Bit = lib.mkDefault true; }; nvidia = { + # "Wayland requires kernel mode setting (KMS) to be enabled (Highly + # Recommended)" per https://wiki.nixos.org/wiki/NVIDIA#Requirements. modesetting.enable = lib.mkDefault true; prime = { # Bus ID of the Intel GPU. From e7358cddb9fa051bc21dae453b6f087aa6c75bf0 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 4 May 2026 17:47:58 -0700 Subject: [PATCH 06/24] framework/13-inch: fix enhanced audio device priority On framework laptops, ensure that the "enhanced audio" sink for the laptop speakers has a lower priority than bluetooth speakers (by giving it the same priority as the laptop speakers, 1009 [1]). Bluetooth speakers have a priority of 1010 [2] by default. NOTE: the existing comment in the code claiming that higher values mean lower priority is incorrect; lower priorities values mean lower priority. [1] https://gitlab.freedesktop.org/pipewire/wireplumber/-/blob/7fa44ef8d0b2f603bd826d399718cef8cf6a800a/src/scripts/monitors/alsa.lua#L218 [2] https://gitlab.freedesktop.org/pipewire/wireplumber/-/blob/7fa44ef8d0b2f603bd826d399718cef8cf6a800a/src/scripts/monitors/bluez.lua#L275 --- framework/13-inch/common/classic-audio.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/framework/13-inch/common/classic-audio.nix b/framework/13-inch/common/classic-audio.nix index db60c52b..e0d41bdc 100644 --- a/framework/13-inch/common/classic-audio.nix +++ b/framework/13-inch/common/classic-audio.nix @@ -315,12 +315,11 @@ in "device.api" = "dsp"; "node.virtual" = "false"; - # Lower seems to mean "more preferred", - # bluetooth devices seem to be ~1000, speakers seem to be ~2000 - # since this is between the two, bluetooth devices take over when they connect, - # and hand over to this instead of the speakers when they disconnect. - "priority.session" = 1500; - "priority.driver" = 1500; + # 1009 is the default priority of the "first" analog audio device. + # Higher priorities (e.g., 1010 for bluetooth and 1100 for usb audio) + # are preferred. + "priority.session" = 1009; + "priority.driver" = 1009; "state.default-volume" = 0.343; "device.icon-name" = "audio-card-analog-pci"; }; From 48c8b5e0bd942604abf8034df9f43803fd31ffd7 Mon Sep 17 00:00:00 2001 From: mkorje Date: Fri, 3 Jul 2026 14:51:40 +1000 Subject: [PATCH 07/24] apple/t2: improve firmware extraction --- apple/t2/pkgs/brcm-firmware/default.nix | 85 +++++++++++-------------- 1 file changed, 37 insertions(+), 48 deletions(-) diff --git a/apple/t2/pkgs/brcm-firmware/default.nix b/apple/t2/pkgs/brcm-firmware/default.nix index 742d6ff6..e444e4f6 100644 --- a/apple/t2/pkgs/brcm-firmware/default.nix +++ b/apple/t2/pkgs/brcm-firmware/default.nix @@ -2,10 +2,7 @@ lib, stdenvNoCC, callPackage, - vmTools, - util-linux, - linux, - kmod, + _7zz, version, }: @@ -38,52 +35,44 @@ let }; in -vmTools.runInLinuxVM ( - stdenvNoCC.mkDerivation { - pname = "brcm-firmware"; - inherit version; +stdenvNoCC.mkDerivation { + pname = "brcm-firmware"; + inherit version; - src = fetchmacos { - name = version; - inherit (boards.${version}) - boardId - mlb - osType - hash - ; - }; - dontUnpack = true; + 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 + nativeBuildInputs = [ + _7zz + get-firmware + ]; + buildPhase = '' + 7zz x -bd -bso0 -bsp0 $src \ + "macOS Base System/usr/share/firmware/bluetooth/*" \ + "macOS Base System/usr/share/firmware/wifi/*" - 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 "macOS Base System/usr/share/firmware/bluetooth" bluetooth/ + get-wifi "macOS Base System/usr/share/firmware/wifi" wifi/ + ''; - 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/ + ''; - 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; - }; - } -) + meta = with lib; { + description = "Wi-Fi and Bluetooth firmware for T2 Macs"; + license = licenses.unfree; + maintainers = with maintainers; [ mkorje ]; + platforms = platforms.linux; + }; +} From cf3de37ade5257f6db860c5582a9c2e31c014e4d Mon Sep 17 00:00:00 2001 From: Logan Rawlins Date: Mon, 16 Dec 2024 21:05:05 -0700 Subject: [PATCH 08/24] gpd/duo: init GPD Duo profile - Fix boot screen invertion. - Add audio fixes for the Framework 13, given a shared chipset. - Add Bluetooth fixes. - Import AMD 7000-series GPU fix (Raphael). - Add GPD PPT (TDP) control from GPD Win Max 2 - Set `panel_orientation` kernel parameter. - Add AC wakeup fix as a config option; disabled by default. - Enable `power-profiles-daemon` by default, and disable TLP - can be configured. - Disable both PSR and PSR-SU on amdgpu module. - Fix touchscreen properties - upside down rotation - Update README.md for GPD Duo. Co-authored-by: Dom Rodriguez --- README.md | 1 + flake.nix | 1 + gpd/duo/default.nix | 60 +++ gpd/duo/duo-specific/amd.nix | 27 ++ gpd/duo/duo-specific/audio.nix | 391 ++++++++++++++++++++ gpd/duo/duo-specific/bluetooth.nix | 56 +++ gpd/duo/duo-specific/default.nix | 20 + gpd/duo/duo-specific/power/default.nix | 6 + gpd/duo/duo-specific/power/power-saving.nix | 18 + gpd/duo/duo-specific/power/ppt.nix | 62 ++++ 10 files changed, 642 insertions(+) create mode 100644 gpd/duo/default.nix create mode 100644 gpd/duo/duo-specific/amd.nix create mode 100644 gpd/duo/duo-specific/audio.nix create mode 100644 gpd/duo/duo-specific/bluetooth.nix create mode 100644 gpd/duo/duo-specific/default.nix create mode 100644 gpd/duo/duo-specific/power/default.nix create mode 100644 gpd/duo/duo-specific/power/power-saving.nix create mode 100644 gpd/duo/duo-specific/power/ppt.nix diff --git a/README.md b/README.md index 4103ad59..e545b037 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,7 @@ See code for all available configurations. | [Gigabyte B550](gigabyte/b550) | `` | `gigabyte-b550` | | [Gigabyte B650](gigabyte/b650) | `` | `gigabyte-b650` | | [GMKtec NucBox G3 Plus](gmktec/nucbox/g3-plus) | `` | `gmktec-nucbox-g3-plus` | +| [GPD Duo](gpd/duo) | `` | `gpd-duo` | | [GPD MicroPC](gpd/micropc) | `` | `gpd-micropc` | | [GPD P2 Max](gpd/p2-max) | `` | `gpd-p2-max` | | [GPD Pocket 3](gpd/pocket-3) | `` | `gpd-pocket-3` | diff --git a/flake.nix b/flake.nix index f4a8c3c6..60c79d80 100644 --- a/flake.nix +++ b/flake.nix @@ -194,6 +194,7 @@ google-pixelbook = import ./google/pixelbook; google-brya = import ./google/brya; google-rex = import ./google/rex; + gpd-duo = import ./gpd/duo; gpd-micropc = import ./gpd/micropc; gpd-p2-max = import ./gpd/p2-max; gpd-pocket-3 = import ./gpd/pocket-3; diff --git a/gpd/duo/default.nix b/gpd/duo/default.nix new file mode 100644 index 00000000..a7d8cb75 --- /dev/null +++ b/gpd/duo/default.nix @@ -0,0 +1,60 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + cfg = config.hardware.gpd.duo; +in +with lib; +{ + imports = [ + ./duo-specific + ../../common/pc/laptop + ../../common/pc/ssd + ../../common/hidpi.nix + ]; + + options = { + hardware.gpd.duo.preventWakeOnAC = mkOption { + type = types.bool; + default = false; + description = '' + Stop the system waking from suspend when the AC is plugged + in. The catch: it also disables waking from the keyboard. + + See: + https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128/45 + ''; + }; + }; + + config = { + # Workaround applied upstream in Linux >=6.7 (on BIOS 03.03) + # https://github.com/torvalds/linux/commit/a55bdad5dfd1efd4ed9ffe518897a21ca8e4e193 + services.udev.extraRules = + mkIf (versionOlder config.boot.kernelPackages.kernel.version "6.7" && cfg.preventWakeOnAC) + '' + # Prevent wake when plugging in AC during suspend. Trade-off: keyboard wake disabled. See: + # https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128/45 + ACTION=="add", SUBSYSTEM=="serio", DRIVERS=="atkbd", ATTR{power/wakeup}="disabled" + ''; + + # Replace 'left' with 'right' or 'inverted' as needed + # Fixes DUO stupid inverted display at boot + # Enable kernel module for your graphics (adjust if needed) + boot.kernelModules = [ "amdgpu" ]; + + # Set the eDP-1 panel video parameters for display rotation + boot.kernelParams = mkBefore [ + "video=eDP-1:2880x1800,panel_orientation=upside_down" + "video=DP-3:2880x1800,panel_orientation=normal" + "i2c_touchscreen_props=GXTP7380:touchscreen-inverted-x:touchscreen-inverted-y" + ]; + + hardware.gpd.duo.audioEnhancement.rawDeviceName = + mkDefault "alsa_output.pci-0000_c1_00.6.analog-stereo"; + }; +} diff --git a/gpd/duo/duo-specific/amd.nix b/gpd/duo/duo-specific/amd.nix new file mode 100644 index 00000000..c2f36a60 --- /dev/null +++ b/gpd/duo/duo-specific/amd.nix @@ -0,0 +1,27 @@ +{ lib, config, ... }: +with lib; +{ + imports = [ + ../../../common/cpu/amd + ../../../common/cpu/amd/pstate.nix + ../../../common/gpu/amd + ]; + + boot.kernelParams = [ + # There seems to be an issue with panel self-refresh (PSR) that + # causes hangs for users. + # + # https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459 + # https://gitlab.freedesktop.org/drm/amd/-/issues/3647 + "amdgpu.dcdebugmask=0x210" + ] + # Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/ + ++ optionals (versionOlder config.boot.kernelPackages.kernel.version "6.8") [ + "rtc_cmos.use_acpi_alarm=1" + ]; + + # AMD has better battery life with PPD over TLP: + # https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13 + services.power-profiles-daemon.enable = mkDefault true; + services.tlp.enable = mkDefault false; +} diff --git a/gpd/duo/duo-specific/audio.nix b/gpd/duo/duo-specific/audio.nix new file mode 100644 index 00000000..d384c273 --- /dev/null +++ b/gpd/duo/duo-specific/audio.nix @@ -0,0 +1,391 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.hardware.gpd.duo.audioEnhancement; +in +with lib; +{ + options = { + hardware.gpd.duo.audioEnhancement = { + enable = mkOption { + type = types.bool; + default = false; + description = '' + Create a new audio device called "DUO Speakers", + which applies sound tuning before sending the audio out to the speakers. + This option requires PipeWire and WirePlumber. + + The filter chain includes the following: + - Pyschoacoustic bass enhancement + - Loudness compensation + - Equalizer + - Slight compression + + This option has been optimised for the Framework Laptop 13 AMD 7040 series, but should work on all models. + + Before applying, ensure the speakers are set to 100%, + because the volumes compound and the raw speaker device will be hidden by default. + + You might also need to re-select the default output device. + + In some cases, the added bass will vibrate the keyboard cable leading to a rattling sound, + a piece of foam can be used to mitigate this. + ''; + }; + + hideRawDevice = mkOption { + type = types.bool; + default = true; + description = '' + Hide the raw speaker device. + This option is enabled by default, because keeping the raw speaker device can lead to volume conflicts. + ''; + }; + + rawDeviceName = mkOption { + type = types.str; + example = "alsa_output.pci-0000_c1_00.6.analog-stereo"; + description = '' + The name of the raw speaker device. This will vary by device. + You can get this by running `pw-dump | grep -C 20 pci-0000`. + ''; + }; + }; + }; + + config = mkIf cfg.enable ( + let + outputName = cfg.rawDeviceName; + prettyName = "Duo Speakers"; + + # These are pre-made decibel to linear value conversions, since Nix doesn't have pow(). + # Use the formula `10 ** (db / 20)` to calculate. + db = { + "-18.1" = 0.1244514611771385; + "-5.48" = 0.5321082592667942; + "-4.76" = 0.5780960474057181; + "8.1" = 2.5409727055493048; + "-36" = 1.5848931924611134e-2; + }; + + json = pkgs.formats.json { }; + + # The filter chain, heavily inspired by the asahi-audio project: https://github.com/AsahiLinux/asahi-audio + filter-chain = json.generate "filter-chain.json" { + "node.description" = prettyName; + "media.name" = prettyName; + "filter.graph" = { + nodes = [ + # Psychoacoustic bass extension, + # it creates harmonics of the missing bass to fool our ears into hearing it. + { + type = "lv2"; + plugin = "https://chadmed.au/bankstown"; + name = "bassex"; + control = { + bypass = 0; + amt = 1.2; + sat_second = 1.3; + sat_third = 2.5; + blend = 1.0; + ceil = 200.0; + floor = 20.0; + }; + } + # Loudness compensation, + # it ensures that the sound profile stays consistent across different volumes. + { + type = "lv2"; + plugin = "http://lsp-plug.in/plugins/lv2/loud_comp_stereo"; + name = "el"; + control = { + enabled = 1; + input = 1.0; + fft = 4; + }; + } + # 8-band equalizer, + # it tries to lessen frequencies where the laptop might resonate, + # and tries to make the frequency curve more pleasing; + # this is the "Lappy McTopface" profile (https://github.com/ceiphr/ee-framework-presets) + # further tuned for the Framework Laptop 13 AMD 7040 series + # and might need some tuning on other models. + { + type = "lv2"; + plugin = "http://lsp-plug.in/plugins/lv2/para_equalizer_x8_lr"; + name = "fw13eq"; + control = { + mode = 0; + react = 0.2; + zoom = db."-36"; + + fl_0 = 101.0; + fml_0 = 0; + ftl_0 = 5; + gl_0 = db."-18.1"; + huel_0 = 0.0; + ql_0 = 4.36; + sl_0 = 0; + wl_0 = 4.0; + + fl_1 = 451.0; + fml_1 = 0; + ftl_1 = 1; + gl_1 = db."-5.48"; + huel_1 = 3.125e-2; + ql_1 = 2.46; + sl_1 = 0; + wl_1 = 4.0; + + fl_2 = 918.0; + fml_2 = 0; + ftl_2 = 1; + gl_2 = db."-4.76"; + huel_2 = 6.25e-2; + ql_2 = 2.44; + sl_2 = 0; + wl_2 = 4.0; + + fl_3 = 9700.0; + fml_3 = 0; + ftl_3 = 1; + gl_3 = db."8.1"; + huel_3 = 9.375e-2; + ql_3 = 2.0; + sl_3 = 0; + wl_3 = 4.0; + + fr_0 = 101.0; + fmr_0 = 0; + ftr_0 = 5; + gr_0 = db."-18.1"; + huer_0 = 0.0; + qr_0 = 4.36; + sr_0 = 0; + wr_0 = 4.0; + + fr_1 = 451.0; + fmr_1 = 0; + ftr_1 = 1; + gr_1 = db."-5.48"; + huer_1 = 3.125e-2; + qr_1 = 2.46; + sr_1 = 0; + wr_1 = 4.0; + + fr_2 = 918.0; + fmr_2 = 0; + ftr_2 = 1; + gr_2 = db."-4.76"; + huer_2 = 6.25e-2; + qr_2 = 2.44; + sr_2 = 0; + wr_2 = 4.0; + + fr_3 = 9700.0; + fmr_3 = 0; + ftr_3 = 1; + gr_3 = db."8.1"; + huer_3 = 9.375e-2; + qr_3 = 2.0; + sr_3 = 0; + wr_3 = 4.0; + }; + } + # Compressors. The settings were taken from the asahi-audio project. + { + type = "lv2"; + plugin = "http://lsp-plug.in/plugins/lv2/mb_compressor_stereo"; + name = "woofer_bp"; + control = { + mode = 0; + ce_0 = 1; + sla_0 = 5.0; + cr_0 = 1.75; + al_0 = 0.725; + at_0 = 1.0; + rt_0 = 100; + kn_0 = 0.125; + cbe_1 = 1; + sf_1 = 200.0; + ce_1 = 0; + cbe_2 = 0; + ce_2 = 0; + cbe_3 = 0; + ce_3 = 0; + cbe_4 = 0; + ce_4 = 0; + cbe_5 = 0; + ce_5 = 0; + cbe_6 = 0; + ce_6 = 0; + }; + } + { + type = "lv2"; + plugin = "http://lsp-plug.in/plugins/lv2/compressor_stereo"; + name = "woofer_lim"; + control = { + sla = 5.0; + al = 1.0; + at = 1.0; + rt = 100.0; + cr = 15.0; + kn = 0.5; + }; + } + ]; + + # Now, we're chaining together the modules instantiated above. + links = [ + { + output = "bassex:out_l"; + input = "el:in_l"; + } + { + output = "bassex:out_r"; + input = "el:in_r"; + } + + { + output = "el:out_l"; + input = "fw13eq:in_l"; + } + { + output = "el:out_r"; + input = "fw13eq:in_r"; + } + { + output = "fw13eq:out_l"; + input = "woofer_bp:in_l"; + } + { + output = "fw13eq:out_r"; + input = "woofer_bp:in_r"; + } + { + output = "woofer_bp:out_l"; + input = "woofer_lim:in_l"; + } + { + output = "woofer_bp:out_r"; + input = "woofer_lim:in_r"; + } + ]; + + inputs = [ + "bassex:in_l" + "bassex:in_r" + ]; + outputs = [ + "woofer_lim:out_l" + "woofer_lim:out_r" + ]; + + # This makes pipewire's volume control actually control the loudness comp module + "capture.volumes" = [ + { + control = "el:volume"; + min = -47.5; + max = 0.0; + scale = "cubic"; + } + ]; + }; + "capture.props" = { + "node.name" = "audio_effect.laptop-convolver"; + "media.class" = "Audio/Sink"; + "audio.channels" = "2"; + "audio.position" = [ + "FL" + "FR" + ]; + "audio.allowed-rates" = [ + 44100 + 48000 + 88200 + 96000 + 176400 + 192000 + ]; + "device.api" = "dsp"; + "node.virtual" = "false"; + + # Lower seems to mean "more preferred", + # bluetooth devices seem to be ~1000, speakers seem to be ~2000 + # since this is between the two, bluetooth devices take over when they connect, + # and hand over to this instead of the speakers when they disconnect. + "priority.session" = 1500; + "priority.driver" = 1500; + "state.default-volume" = 0.343; + "device.icon-name" = "audio-card-analog-pci"; + }; + "playback.props" = { + "node.name" = "audio_effect.laptop-convolver"; + "target.object" = outputName; + "node.passive" = "true"; + "audio.channels" = "2"; + "audio.allowed-rates" = [ + 44100 + 48000 + 88200 + 96000 + 176400 + 192000 + ]; + "audio.position" = [ + "FL" + "FR" + ]; + "device.icon-name" = "audio-card-analog-pci"; + }; + }; + + configPackage = + (pkgs.writeTextDir "share/wireplumber/wireplumber.conf.d/99-laptop.conf" '' + monitor.alsa.rules = [ + { + matches = [{ node.name = "${outputName}" }] + actions = { + update-props = { + audio.allowed-rates = [44100, 48000, 88200, 96000, 176400, 192000] + } + } + } + ] + + node.software-dsp.rules = [ + { + matches = [{ node.name = "${outputName}" }] + actions = { + create-filter = { + filter-path = "${filter-chain}" + hide-parent = ${boolToString cfg.hideRawDevice} + } + } + } + ] + + wireplumber.profiles = { + main = { node.software-dsp = "required" } + } + '') + // { + passthru.requiredLv2Packages = with pkgs; [ + lsp-plugins + bankstown-lv2 + ]; + }; + in + { + services.pipewire.wireplumber.configPackages = [ configPackage ]; + + # Pipewire is needed for this. + services.pipewire.enable = mkDefault true; + } + ); +} diff --git a/gpd/duo/duo-specific/bluetooth.nix b/gpd/duo/duo-specific/bluetooth.nix new file mode 100644 index 00000000..01a167b2 --- /dev/null +++ b/gpd/duo/duo-specific/bluetooth.nix @@ -0,0 +1,56 @@ +# There is apparently a bug that affects Framework computers that causes black +# screen on resume from sleep or hibernate with kernel version 6.11. Framework +# have published a workaround; this applies that workaround. +# +# https://fosstodon.org/@frameworkcomputer/113406887743149089 +# https://github.com/FrameworkComputer/linux-docs/blob/main/hibernation/kernel-6-11-workarounds/suspend-hibernate-bluetooth-workaround.md#workaround-for-suspendhibernate-black-screen-on-resume-kernel-611 +{ + config, + lib, + pkgs, + ... +# TODO: drop this if linux 6.11 goes EOL +}: +with lib; +mkIf + ( + (config.boot.kernelPackages.kernelAtLeast "6.11") && (config.boot.kernelPackages.kernelOlder "6.12") + ) + { + systemd.services = { + bluetooth-rfkill-suspend = { + description = "Soft block Bluetooth on suspend/hibernate"; + before = [ "sleep.target" ]; + unitConfig.StopWhenUnneeded = true; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.util-linux}/bin/rfkill block bluetooth"; + ExecStartPost = "${pkgs.coreutils}/bin/sleep 3"; + RemainAfterExit = true; + }; + wantedBy = [ + "suspend.target" + "hibernate.target" + "suspend-then-hibernate.target" + ]; + }; + + bluetooth-rfkill-resume = { + description = "Unblock Bluetooth on resume"; + after = [ + "suspend.target" + "hibernate.target" + "suspend-then-hibernate.target" + ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.util-linux}/bin/rfkill unblock bluetooth"; + }; + wantedBy = [ + "suspend.target" + "hibernate.target" + "suspend-then-hibernate.target" + ]; + }; + }; + } diff --git a/gpd/duo/duo-specific/default.nix b/gpd/duo/duo-specific/default.nix new file mode 100644 index 00000000..2b5eaef3 --- /dev/null +++ b/gpd/duo/duo-specific/default.nix @@ -0,0 +1,20 @@ +{ lib, pkgs, ... }: +with lib; +{ + imports = [ + ../../../common/cpu/amd/raphael/igpu.nix + ./bluetooth.nix + ./amd.nix + ./audio.nix + ./power + ]; + + # Fix TRRS headphones missing a mic + # https://community.frame.work/t/headset-microphone-on-linux/12387/3 + boot.extraModprobeConfig = mkIf (versionOlder pkgs.linux.version "6.6.8") '' + options snd-hda-intel model=dell-headset-multi + ''; + + # Needed for desktop environments to detect/manage display brightness + hardware.sensor.iio.enable = mkDefault true; +} diff --git a/gpd/duo/duo-specific/power/default.nix b/gpd/duo/duo-specific/power/default.nix new file mode 100644 index 00000000..eb5a5d0a --- /dev/null +++ b/gpd/duo/duo-specific/power/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./ppt.nix + ./power-saving.nix + ]; +} diff --git a/gpd/duo/duo-specific/power/power-saving.nix b/gpd/duo/duo-specific/power/power-saving.nix new file mode 100644 index 00000000..9c534040 --- /dev/null +++ b/gpd/duo/duo-specific/power/power-saving.nix @@ -0,0 +1,18 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.hardware.gpd.duo.powerManagement; +in +{ + options.hardware.gpd.duo.powerManagement = { + enable = mkEnableOption "Enable power-profiles-daemon and disable TLP for the GPD Duo" // { + # Default increase PPT to the BIOS default when power adapter plugin to increase performance. + default = true; + }; + }; + + config = mkIf cfg.enable { + services.power-profiles-daemon.enable = mkDefault true; + services.tlp.enable = mkForce false; + }; +} diff --git a/gpd/duo/duo-specific/power/ppt.nix b/gpd/duo/duo-specific/power/ppt.nix new file mode 100644 index 00000000..4efb73f2 --- /dev/null +++ b/gpd/duo/duo-specific/power/ppt.nix @@ -0,0 +1,62 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; +let + cfg = config.hardware.gpd.ppt; +in +{ + options.hardware.gpd.ppt = { + enable = mkEnableOption "Enable PPT control for device by ryzenadj." // { + # Default increase PPT to the BIOS default when power adapter plugin to increase performance. + default = true; + }; + + adapter = { + fast-limit = mkOption { + description = "Fast PTT Limit(milliwatt) when power adapter plugin."; + default = 35000; + type = types.ints.unsigned; + }; + slow-limit = mkOption { + description = "Slow PTT Limit(milliwatt) when power adapter plugin."; + default = 32000; + type = types.ints.unsigned; + }; + stapm-limit = mkOption { + description = "Stapm PTT Limit(milliwatt) when power adapter plugin."; + default = 28000; + type = types.ints.unsigned; + }; + }; + + battery = { + fast-limit = mkOption { + description = "Fast PTT Limit(milliwatt) when using battery."; + default = 24000; + type = types.ints.unsigned; + }; + slow-limit = mkOption { + description = "Slow PTT Limit(milliwatt) when using battery."; + default = 22000; + type = types.ints.unsigned; + }; + stapm-limit = mkOption { + description = "Stapm PTT Limit(milliwatt) when using battery."; + default = 22000; + type = types.ints.unsigned; + }; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [ pkgs.ryzenadj ]; + services.udev.extraRules = '' + SUBSYSTEM=="power_supply", KERNEL=="ADP1", ATTR{online}=="1", RUN+="${getExe pkgs.ryzenadj} --stapm-limit ${toString cfg.adapter.stapm-limit} --fast-limit ${toString cfg.adapter.fast-limit} --slow-limit ${toString cfg.adapter.slow-limit}" + SUBSYSTEM=="power_supply", KERNEL=="ADP1", ATTR{online}=="0", RUN+="${getExe pkgs.ryzenadj} --stapm-limit ${toString cfg.battery.stapm-limit} --fast-limit ${toString cfg.battery.fast-limit} --slow-limit ${toString cfg.battery.slow-limit}" + ''; + }; +} From 9408ef97db4005ac3b093b98d4e26ffa653bb3e8 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Mon, 17 Aug 2026 10:48:17 +0200 Subject: [PATCH 09/24] common/gpu/amd: add hardware.amdgpu.dcDebugMask options This allows to combine several such options to get the right hex value without any repeated kernel params. Before this, the framework AI 300 got both 0x10 and 0x410 on the cmdline with the order depending on the module system eval order. This also allows users to re-enable PSR on framework machines. --- common/gpu/amd/dc-debug-mask.nix | 36 +++++++++++++++++++ common/gpu/amd/default.nix | 2 ++ framework/13-inch/common/amd.nix | 24 ++++++------- .../16-inch/amd-ai-300-series/default.nix | 3 +- framework/16-inch/common/amd.nix | 24 ++++++------- 5 files changed, 64 insertions(+), 25 deletions(-) create mode 100644 common/gpu/amd/dc-debug-mask.nix diff --git a/common/gpu/amd/dc-debug-mask.nix b/common/gpu/amd/dc-debug-mask.nix new file mode 100644 index 00000000..5c73dfc7 --- /dev/null +++ b/common/gpu/amd/dc-debug-mask.nix @@ -0,0 +1,36 @@ +# Flag values from drivers/gpu/drm/amd/include/amd_shared.h +{ config, lib, ... }: +let + flags = { + disablePipeSplit = 1; + disableStutter = 2; + disableDsc = 4; + disableClockGating = 8; + disablePsr = 16; + disableMpo = 64; + disablePsrSu = 512; + disableReplay = 1024; + disableIps = 2048; + }; + + cfg = config.hardware.amdgpu.dcDebugMask; + + mask = lib.foldlAttrs ( + acc: name: bit: + if cfg.${name} then lib.bitOr acc bit else acc + ) 0 flags; +in +{ + options.hardware.amdgpu.dcDebugMask = lib.mapAttrs ( + _name: bit: + lib.mkOption { + type = lib.types.bool; + default = false; + description = "Set flag 0x${lib.toHexString bit} in amdgpu.dcdebugmask."; + } + ) flags; + + config = lib.mkIf (mask != 0) { + boot.kernelParams = [ "amdgpu.dcdebugmask=0x${lib.toHexString mask}" ]; + }; +} diff --git a/common/gpu/amd/default.nix b/common/gpu/amd/default.nix index f6903d9e..5bb4546e 100644 --- a/common/gpu/amd/default.nix +++ b/common/gpu/amd/default.nix @@ -1,6 +1,8 @@ { lib, ... }: { + imports = [ ./dc-debug-mask.nix ]; + config = { services.xserver.videoDrivers = lib.mkDefault [ "modesetting" ]; diff --git a/framework/13-inch/common/amd.nix b/framework/13-inch/common/amd.nix index 4a89f8da..fc34d3dc 100644 --- a/framework/13-inch/common/amd.nix +++ b/framework/13-inch/common/amd.nix @@ -6,18 +6,18 @@ ../../../common/gpu/amd ]; - boot.kernelParams = [ - # There seems to be an issue with panel self-refresh (PSR) that - # causes hangs for users. - # - # https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459 - # https://gitlab.freedesktop.org/drm/amd/-/issues/3647 - "amdgpu.dcdebugmask=0x10" - ] - # Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/ - ++ lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") [ - "rtc_cmos.use_acpi_alarm=1" - ]; + # There seems to be an issue with panel self-refresh (PSR) that + # causes hangs for users. + # + # https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459 + # https://gitlab.freedesktop.org/drm/amd/-/issues/3647 + hardware.amdgpu.dcDebugMask.disablePsr = lib.mkDefault true; + + boot.kernelParams = + # Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/ + lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") [ + "rtc_cmos.use_acpi_alarm=1" + ]; # AMD has better battery life with PPD over TLP: # https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13 diff --git a/framework/16-inch/amd-ai-300-series/default.nix b/framework/16-inch/amd-ai-300-series/default.nix index 1e42fff1..c4d4e911 100644 --- a/framework/16-inch/amd-ai-300-series/default.nix +++ b/framework/16-inch/amd-ai-300-series/default.nix @@ -21,8 +21,9 @@ # The following mitigations fix various graphics issues # See https://gist.github.com/lbrame/f9034b1a9fe4fc2d2835c5542acb170a#user-content-quick-version-apply-the-mitigations-i-am-personally-using + hardware.amdgpu.dcDebugMask.disableReplay = lib.mkDefault true; + boot.kernelParams = [ - "amdgpu.dcdebugmask=0x410" "amdgpu.sg_display=0" "amdgpu.abmlevel=0" ]; diff --git a/framework/16-inch/common/amd.nix b/framework/16-inch/common/amd.nix index 4a89f8da..fc34d3dc 100644 --- a/framework/16-inch/common/amd.nix +++ b/framework/16-inch/common/amd.nix @@ -6,18 +6,18 @@ ../../../common/gpu/amd ]; - boot.kernelParams = [ - # There seems to be an issue with panel self-refresh (PSR) that - # causes hangs for users. - # - # https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459 - # https://gitlab.freedesktop.org/drm/amd/-/issues/3647 - "amdgpu.dcdebugmask=0x10" - ] - # Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/ - ++ lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") [ - "rtc_cmos.use_acpi_alarm=1" - ]; + # There seems to be an issue with panel self-refresh (PSR) that + # causes hangs for users. + # + # https://community.frame.work/t/fedora-kde-becomes-suddenly-slow/58459 + # https://gitlab.freedesktop.org/drm/amd/-/issues/3647 + hardware.amdgpu.dcDebugMask.disablePsr = lib.mkDefault true; + + boot.kernelParams = + # Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/ + lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") [ + "rtc_cmos.use_acpi_alarm=1" + ]; # AMD has better battery life with PPD over TLP: # https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13 From f5cda04f93e4ef73752300b4c921d2dc4e48776d Mon Sep 17 00:00:00 2001 From: pancho horrillo Date: Thu, 20 Aug 2026 09:34:39 +0200 Subject: [PATCH 10/24] intel/nuc/8i7beh: use coffee-lake cpu config --- intel/nuc/8i7beh/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intel/nuc/8i7beh/default.nix b/intel/nuc/8i7beh/default.nix index 5dfed4ef..cbc429ae 100644 --- a/intel/nuc/8i7beh/default.nix +++ b/intel/nuc/8i7beh/default.nix @@ -2,7 +2,7 @@ { imports = [ - ../../../common/cpu/intel + ../../../common/cpu/intel/coffee-lake ]; services.thermald.enable = lib.mkDefault true; From 7f0552abed960ae3100498386d531f2eed59412f Mon Sep 17 00:00:00 2001 From: pancho horrillo Date: Thu, 20 Aug 2026 09:36:33 +0200 Subject: [PATCH 11/24] intel/nuc/8i7beh: add pc ssd imports --- intel/nuc/8i7beh/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/intel/nuc/8i7beh/default.nix b/intel/nuc/8i7beh/default.nix index cbc429ae..22b15b6a 100644 --- a/intel/nuc/8i7beh/default.nix +++ b/intel/nuc/8i7beh/default.nix @@ -3,6 +3,8 @@ { imports = [ ../../../common/cpu/intel/coffee-lake + ../../../common/pc + ../../../common/pc/ssd ]; services.thermald.enable = lib.mkDefault true; From 5ad14a9e0c3c78334afa050b603578b5ae74c511 Mon Sep 17 00:00:00 2001 From: Jakob Leifhelm Date: Wed, 2 Sep 2026 18:08:05 +0200 Subject: [PATCH 12/24] mnt/reform: convert update patches to derivation --- mnt/reform/updateKernelPatches.nix | 9 ++++++--- mnt/reform/updateKernelPatches.sh | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mnt/reform/updateKernelPatches.nix b/mnt/reform/updateKernelPatches.nix index e30bd6f9..a21180ca 100644 --- a/mnt/reform/updateKernelPatches.nix +++ b/mnt/reform/updateKernelPatches.nix @@ -1,4 +1,5 @@ { + runCommand, lib, fetchFromGitLab, }: @@ -7,6 +8,8 @@ let sources = lib.importJSON ./sources.json; reformDebianPackages = fetchFromGitLab sources.reformDebianPackages; in -map (lib.removePrefix "${reformDebianPackages}/") ( - lib.filesystem.listFilesRecursive "${reformDebianPackages}/linux/patches${lib.versions.majorMinor sources.modDirVersion}" -) +runCommand "mnt-reform-kernel-patches" { } '' + shopt -s globstar + cd ${reformDebianPackages} + echo "[ $(printf '"%s"' linux/patches${lib.versions.majorMinor sources.modDirVersion}/**/*.patch) ]" > $out +'' diff --git a/mnt/reform/updateKernelPatches.sh b/mnt/reform/updateKernelPatches.sh index 79581c7d..73d4ef5a 100755 --- a/mnt/reform/updateKernelPatches.sh +++ b/mnt/reform/updateKernelPatches.sh @@ -1,4 +1,5 @@ #!/usr/bin/env sh -nix eval .#mnt-reform-kernel-patches > kernelPatches.nix +nix build .#mnt-reform-kernel-patches +cp result kernelPatches.nix nix fmt kernelPatches.nix From d9d31dfb5e1beb85e1cb689687879c4e1ce3fc2d Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Fri, 11 Sep 2026 15:08:31 -0700 Subject: [PATCH 13/24] raspberry-pi/common/kernel: 6.18.39-stable_20260724 -> 6.18.50-stable_20260911 --- raspberry-pi/common/kernel.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/raspberry-pi/common/kernel.nix b/raspberry-pi/common/kernel.nix index ed4ad9b5..92b73547 100644 --- a/raspberry-pi/common/kernel.nix +++ b/raspberry-pi/common/kernel.nix @@ -10,9 +10,9 @@ let # NOTE: raspberryPiWirelessFirmware should be updated with this - modDirVersion = "6.18.39"; - tag = "stable_20260724"; - hash = "sha256-IT/SkF458oLmnFIPbN76Qp6s8KVxKQOC02XmN7NRdBc="; + modDirVersion = "6.18.50"; + tag = "stable_20260911"; + hash = "sha256-rIYYt4AzTZnZO1v8Gv6byJFXm4gQDlColgRSu09/9F4="; inherit (lib.kernel) freeform yes no; in (buildLinux ( From 9e57f21b40610c74acd6d89fa5554651d29a20f0 Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Fri, 11 Sep 2026 15:08:31 -0700 Subject: [PATCH 14/24] raspberrypiWirelessFirmware: 0-unstable-2026-03-21 -> 0-unstable-2026-07-10 --- raspberry-pi/common/raspberry-pi-wireless-firmware.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/raspberry-pi/common/raspberry-pi-wireless-firmware.nix b/raspberry-pi/common/raspberry-pi-wireless-firmware.nix index 17ef3fda..e5b20784 100644 --- a/raspberry-pi/common/raspberry-pi-wireless-firmware.nix +++ b/raspberry-pi/common/raspberry-pi-wireless-firmware.nix @@ -6,7 +6,7 @@ stdenvNoCC.mkDerivation { pname = "raspberrypi-wireless-firmware"; - version = "0-unstable-2026-03-21"; + version = "0-unstable-2026-07-10"; srcs = [ (fetchFromGitHub { @@ -20,8 +20,8 @@ stdenvNoCC.mkDerivation { name = "firmware-nonfree"; owner = "RPi-Distro"; repo = "firmware-nonfree"; - rev = "9794282eb9f4a2de1f23b41a738926740e975d83"; - hash = "sha256-OtA8yHvfusGP/ucf8Exzi+nSUmNoYp10u+luC2gbNZc="; + rev = "3bab0f823f5b53150b76aab77093adef6655b920"; + hash = "sha256-2DXj2esIix8YQwBf3IuzHwnUJ+yCANbRdpyS/DeB4XE="; }) ]; @@ -36,7 +36,8 @@ stdenvNoCC.mkDerivation { mkdir -p "$out/lib/firmware/brcm" # Wifi firmware - cp -r "firmware-nonfree/debian/config/brcm80211/." "$out/lib/firmware/" + cp -r "firmware-nonfree/debian/added-firmware/brcm" "$out/lib/firmware/" + cp -r "firmware-nonfree/debian/added-firmware/cypress" "$out/lib/firmware/" # Bluetooth firmware cp -r "bluez-firmware/debian/firmware/broadcom/." "$out/lib/firmware/brcm" From a2da909d035d719e4702b55efa6b7c6eacd5c5b1 Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Wed, 2 Sep 2026 09:16:10 -0700 Subject: [PATCH 15/24] codeowners: add doronbehar to raspberry-pi --- CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/CODEOWNERS b/CODEOWNERS index f0a1b5a4..6ccf8247 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -8,6 +8,7 @@ pcengines/apu @yegortimoshenko pine64/rockpro64 @tomfitzhenry pine64/star64 @fgaz purism/librem/13v3 @yegortimoshenko +raspberry-pi @doronbehar system76/darp6 @khumba framework @emiller88 @johnazoidberg tuxedo/pulse/15/gen2 @trueNAHO From 8d1085c662550f765c259132607991989d2ce277 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2026 02:06:10 +0000 Subject: [PATCH 16/24] build(deps): bump nixpkgs from `3497aa5` to `b1b8759` Bumps [nixpkgs](https://github.com/NixOS/nixpkgs) from `3497aa5` to `b1b8759`. - [Commits](https://github.com/NixOS/nixpkgs/commits) --- updated-dependencies: - dependency-name: nixpkgs dependency-version: b1b875982b17dabde9b4a37f3e229e74913e6db3 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 67a1708d..1187da68 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1767892417, - "narHash": "sha256-8bW3q88CEg2u4hSP66Vf4lpbLonHz7hqDNBMcCY7E9U=", - "rev": "3497aa5c9457a9d88d71fa93a4a8368816fbeeba", + "lastModified": 1789546076, + "narHash": "sha256-vWkSk5bbfTqdtMoSgD9FshACO8JCvXTFi+3cqEp0mH0=", + "rev": "b1b875982b17dabde9b4a37f3e229e74913e6db3", "type": "tarball", - "url": "https://releases.nixos.org/nixos/unstable/nixos-26.05pre924538.3497aa5c9457/nixexprs.tar.xz" + "url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1074753.b1b875982b17/nixexprs.tar.xz" }, "original": { "type": "tarball", From a6a3926fb0041b3ea9dc9706d87ab9136a4ef93e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2026 02:06:28 +0000 Subject: [PATCH 17/24] build(deps): bump nixos-unstable-small in /tests Bumps [nixos-unstable-small](https://github.com/NixOS/nixpkgs) from `d4a57f1` to `bc071da`. - [Commits](https://github.com/NixOS/nixpkgs/commits) --- updated-dependencies: - dependency-name: nixos-unstable-small dependency-version: bc071daf4c377dd821398672fafe269d5c654ce8 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- tests/flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/flake.lock b/tests/flake.lock index 09bc7112..9d1ef67b 100644 --- a/tests/flake.lock +++ b/tests/flake.lock @@ -15,11 +15,11 @@ }, "nixos-unstable-small": { "locked": { - "lastModified": 1784157011, - "narHash": "sha256-k3oN75PtDT9xJfc4zqgah7ulSaw1Bv/XDuMrXaHupEE=", - "rev": "d4a57f162b50db6d7e49580a772ccbdb3a1605a4", + "lastModified": 1789590615, + "narHash": "sha256-Kdzc9cA73knnnxYsWcfV1fL1Ru4sCYSjRvIpZBFKrL8=", + "rev": "bc071daf4c377dd821398672fafe269d5c654ce8", "type": "tarball", - "url": "https://releases.nixos.org/nixos/unstable-small/nixos-26.11pre1035646.d4a57f162b50/nixexprs.tar.xz" + "url": "https://releases.nixos.org/nixos/unstable-small/nixos-26.11pre1075076.bc071daf4c37/nixexprs.tar.xz" }, "original": { "type": "tarball", From 0d5773cd294a83749e3ce0af1450141963972ca6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2026 02:06:43 +0000 Subject: [PATCH 18/24] build(deps): bump nixos-stable from `8eeec93` to `4c78701` in /tests Bumps [nixos-stable](https://github.com/NixOS/nixpkgs) from `8eeec93` to `4c78701`. - [Commits](https://github.com/NixOS/nixpkgs/commits) --- updated-dependencies: - dependency-name: nixos-stable dependency-version: 4c7870105e7f1fdf9c48688c8d7efc21abf0688a dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- tests/flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/flake.lock b/tests/flake.lock index 09bc7112..2f41bb02 100644 --- a/tests/flake.lock +++ b/tests/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixos-stable": { "locked": { - "lastModified": 1784011430, - "narHash": "sha256-LX2eBS9gFbXL5xUNBwp5mZ0tjnNvgiXoDnhz3ee1LzY=", - "rev": "8eeec934ae0dbeca3d7868c059568a65c08b2fc3", + "lastModified": 1789542786, + "narHash": "sha256-BGtBoaZNpOPDEBLTiWNFdYppnDjGhwrUq5/P15QwrrM=", + "rev": "4c7870105e7f1fdf9c48688c8d7efc21abf0688a", "type": "tarball", - "url": "https://releases.nixos.org/nixos/26.05/nixos-26.05.4937.8eeec934ae0d/nixexprs.tar.xz" + "url": "https://releases.nixos.org/nixos/26.05/nixos-26.05.9904.4c7870105e7f/nixexprs.tar.xz" }, "original": { "type": "tarball", From 8ff87fffcfdd6bbaa47691ec635c9f63c0114141 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Tue, 30 Dec 2025 23:44:32 +0100 Subject: [PATCH 19/24] thinkpad/x1-extreme/gen2: improve CPU configuration Specifically, explicitly configure for coffee-lake CPU. --- lenovo/thinkpad/x1-extreme/gen2/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/lenovo/thinkpad/x1-extreme/gen2/default.nix b/lenovo/thinkpad/x1-extreme/gen2/default.nix index 17147b53..38560b8e 100644 --- a/lenovo/thinkpad/x1-extreme/gen2/default.nix +++ b/lenovo/thinkpad/x1-extreme/gen2/default.nix @@ -5,6 +5,7 @@ with lib; { imports = [ ../. + ../../../../common/cpu/intel/coffee-lake ]; # Fixes an issue with incorrect battery reporting. See From 2326b904ef56cce39ba56d2d94c9db356d50c547 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Tue, 30 Dec 2025 23:45:21 +0100 Subject: [PATCH 20/24] thinkpad/x1-extreme/gen2: fix trackpad press events --- lenovo/thinkpad/x1-extreme/gen2/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lenovo/thinkpad/x1-extreme/gen2/default.nix b/lenovo/thinkpad/x1-extreme/gen2/default.nix index 38560b8e..25023300 100644 --- a/lenovo/thinkpad/x1-extreme/gen2/default.nix +++ b/lenovo/thinkpad/x1-extreme/gen2/default.nix @@ -16,6 +16,9 @@ with lib; # See also https://certification.ubuntu.com/catalog/component/input/5313/input%3ATPPS/2ElanTrackPoint/ hardware.trackpoint.device = "TPPS/2 Elan TrackPoint"; + # Fix clickpad (clicking by depressing the touchpad). + boot.kernelParams = [ "psmouse.synaptics_intertouch=0" ]; + # Since the HDMI port is connected to the NVIDIA card. hardware.bumblebee.connectDisplay = true; From c21024523e6c9cd04fa9cf83c5df208b67926a73 Mon Sep 17 00:00:00 2001 From: Dom Rodriguez Date: Sat, 26 Sep 2026 20:33:44 +0100 Subject: [PATCH 21/24] fix(gpd): de-dupe hardware.gpd.ppt module between duo and win-max-2 Both devices defined their own copy of options.hardware.gpd.ppt, which collides when every module is imported together (breaks search.nuschtos.de). Move the shared module to gpd/ppt.nix and have both devices import it. --- gpd/duo/duo-specific/bluetooth.nix | 2 +- gpd/duo/duo-specific/power/default.nix | 2 +- gpd/{duo/duo-specific/power => }/ppt.nix | 4 ++ gpd/win-max-2/default.nix | 68 +----------------------- 4 files changed, 8 insertions(+), 68 deletions(-) rename gpd/{duo/duo-specific/power => }/ppt.nix (91%) diff --git a/gpd/duo/duo-specific/bluetooth.nix b/gpd/duo/duo-specific/bluetooth.nix index 01a167b2..bdc530b9 100644 --- a/gpd/duo/duo-specific/bluetooth.nix +++ b/gpd/duo/duo-specific/bluetooth.nix @@ -9,7 +9,7 @@ lib, pkgs, ... -# TODO: drop this if linux 6.11 goes EOL + # TODO: drop this if linux 6.11 goes EOL }: with lib; mkIf diff --git a/gpd/duo/duo-specific/power/default.nix b/gpd/duo/duo-specific/power/default.nix index eb5a5d0a..814ae900 100644 --- a/gpd/duo/duo-specific/power/default.nix +++ b/gpd/duo/duo-specific/power/default.nix @@ -1,6 +1,6 @@ { imports = [ - ./ppt.nix + ../../../ppt.nix ./power-saving.nix ]; } diff --git a/gpd/duo/duo-specific/power/ppt.nix b/gpd/ppt.nix similarity index 91% rename from gpd/duo/duo-specific/power/ppt.nix rename to gpd/ppt.nix index 4efb73f2..ffbf2a56 100644 --- a/gpd/duo/duo-specific/power/ppt.nix +++ b/gpd/ppt.nix @@ -9,6 +9,10 @@ let cfg = config.hardware.gpd.ppt; in { + # Linux default PPT is 24-22-22, BIOS default PPT is 35-32-28. It can be controlled by ryzenadj. + + # NOTICE: Whenever you can limit PPT to 15W by pressing Fn + Shift to enter quiet mode. + options.hardware.gpd.ppt = { enable = mkEnableOption "Enable PPT control for device by ryzenadj." // { # Default increase PPT to the BIOS default when power adapter plugin to increase performance. diff --git a/gpd/win-max-2/default.nix b/gpd/win-max-2/default.nix index c9762cd6..47e2dbe6 100644 --- a/gpd/win-max-2/default.nix +++ b/gpd/win-max-2/default.nix @@ -1,72 +1,8 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; -let - cfg = config.hardware.gpd.ppt; -in -{ +{ ... }: { imports = [ ../../common/pc/laptop ../../common/pc/ssd ../../common/hidpi.nix + ../ppt.nix ]; - - # Linux default PPT is 24-22-22, BIOS default PPT is 35-32-28. It can be controlled by ryzenadj. - - # NOTICE: Whenever you can limit PPT to 15W by pressing Fn + Shift to enter quiet mode. - - options.hardware.gpd.ppt = { - enable = mkEnableOption "Enable PPT control for device by ryzenadj." // { - # Default increase PPT to the BIOS default when power adapter plugin to increase performance. - default = true; - }; - - adapter = { - fast-limit = mkOption { - description = "Fast PTT Limit(milliwatt) when power adapter plugin."; - default = 35000; - type = types.ints.unsigned; - }; - slow-limit = mkOption { - description = "Slow PTT Limit(milliwatt) when power adapter plugin."; - default = 32000; - type = types.ints.unsigned; - }; - stapm-limit = mkOption { - description = "Stapm PTT Limit(milliwatt) when power adapter plugin."; - default = 28000; - type = types.ints.unsigned; - }; - }; - - battery = { - fast-limit = mkOption { - description = "Fast PTT Limit(milliwatt) when using battery."; - default = 24000; - type = types.ints.unsigned; - }; - slow-limit = mkOption { - description = "Slow PTT Limit(milliwatt) when using battery."; - default = 22000; - type = types.ints.unsigned; - }; - stapm-limit = mkOption { - description = "Stapm PTT Limit(milliwatt) when using battery."; - default = 22000; - type = types.ints.unsigned; - }; - }; - }; - - config = mkIf cfg.enable { - environment.systemPackages = [ pkgs.ryzenadj ]; - services.udev.extraRules = '' - SUBSYSTEM=="power_supply", KERNEL=="ADP1", ATTR{online}=="1", RUN+="${pkgs.ryzenadj}/bin/ryzenadj --stapm-limit ${toString cfg.adapter.stapm-limit} --fast-limit ${toString cfg.adapter.fast-limit} --slow-limit ${toString cfg.adapter.slow-limit}" - SUBSYSTEM=="power_supply", KERNEL=="ADP1", ATTR{online}=="0", RUN+="${pkgs.ryzenadj}/bin/ryzenadj --stapm-limit ${toString cfg.battery.stapm-limit} --fast-limit ${toString cfg.battery.fast-limit} --slow-limit ${toString cfg.battery.slow-limit}" - ''; - }; } From d55480c9ac195ecf0b9147592554134bfb4b37e3 Mon Sep 17 00:00:00 2001 From: Dom Rodriguez Date: Sat, 26 Sep 2026 20:35:17 +0100 Subject: [PATCH 22/24] feat(gpd): enable ryzenadj PPT control on pocket-4 and win-mini 2024 Both are AMD-based GPD devices that didn't wire up the shared hardware.gpd.ppt module. --- gpd/pocket-4/default.nix | 1 + gpd/win-mini/2024/default.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/gpd/pocket-4/default.nix b/gpd/pocket-4/default.nix index cb44fe65..fbd5abee 100644 --- a/gpd/pocket-4/default.nix +++ b/gpd/pocket-4/default.nix @@ -10,6 +10,7 @@ in ../../common/cpu/amd/pstate.nix ../../common/gpu/amd ../../common/hidpi.nix + ../ppt.nix ]; boot = { diff --git a/gpd/win-mini/2024/default.nix b/gpd/win-mini/2024/default.nix index c8eb1bfd..6f93e46c 100644 --- a/gpd/win-mini/2024/default.nix +++ b/gpd/win-mini/2024/default.nix @@ -6,6 +6,7 @@ with lib; ../../../common/cpu/amd ../../../common/cpu/amd/pstate.nix ../../../common/gpu/amd + ../../ppt.nix ]; hardware.bluetooth.enable = lib.mkDefault true; From 34fef44f657aadf862ccd470e047d579f601b9f6 Mon Sep 17 00:00:00 2001 From: eymeric Date: Sun, 20 Sep 2026 17:05:08 +0200 Subject: [PATCH 23/24] raspberry-pi/firmware: stage vendor overlays independent of dtbSrc install-rpi-firmware picks a single $dtbSrc for both the base .dtb files and the overlays/ directory staged onto the firmware partition. When useGenerationDeviceTree = true, $dtbSrc becomes /run/current-system/dtbs, the NixOS generation's device-tree output. That directory never has an overlays/ subdirectory unless the generation was itself built with hardware.deviceTree.overlays, so the "stage overlays from $dtbSrc/overlays" step silently does nothing, and the stale-file prune then deletes any vendor .dtbo already sitting in the firmware partition's overlays/ from a previous run. In practice this makes hardware.raspberry-pi.configtxt.deviceTreeOverlays non-functional whenever useGenerationDeviceTree = true is also set - a combination that legitimately occurs, e.g. a Pi 4 profile needing apply-overlays-dtmerge/tc358743 (which requires the generation's dtmerge-produced dtb as the base, since boot.loader.generic-extlinux-compatible.useGenerationDeviceTree is usually false with U-Boot enabled) together with a stock overlay like dwc2 applied by the firmware from config.txt. Stage vendor overlays from $firmwareBoot/overlays unconditionally, since hardware.raspberry-pi.configtxt.deviceTreeOverlays entries are matched against that vendor filename set regardless of where the base dtb comes from. Additionally stage $dtbSrc/overlays when it differs from $firmwareBoot and exists, so overlays produced by hardware.deviceTree.overlays on the generation side still take precedence over same-named vendor ones. Related: #1946 Assisted-by: Claude sonnet 5 high --- raspberry-pi/common/firmware.nix | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/raspberry-pi/common/firmware.nix b/raspberry-pi/common/firmware.nix index f3631ff2..2f7baf8d 100644 --- a/raspberry-pi/common/firmware.nix +++ b/raspberry-pi/common/firmware.nix @@ -70,14 +70,32 @@ let kept[$dst]=1 done - if [ -d "$dtbSrc/overlays" ]; then - for ovr in "$dtbSrc"/overlays/*; do + # hardware.raspberry-pi.configtxt.deviceTreeOverlays entries are + # matched by filename against the vendor .dtbo set the Raspberry Pi + # firmware ships, regardless of whether the *base* dtb above came + # from the generation or from firmwareBoot. Stage those + # unconditionally so config.txt's "dtoverlay=" lines have a target + # to apply, even when useGenerationDeviceTree = true. + if [ -d "$firmwareBoot/overlays" ]; then + for ovr in "$firmwareBoot"/overlays/*; do dst="$target/overlays/$(basename "$ovr")" copyForced "$ovr" "$dst" kept[$dst]=1 done fi + # When useGenerationDeviceTree also produced its own overlays + # (built via hardware.deviceTree.overlays), stage those too, + # letting them take precedence over same-named vendor overlays. + if [ "$dtbSrc" != "$firmwareBoot" ] && [ -d "$dtbSrc/overlays" ]; then + for ovr in "$dtbSrc"/overlays/*; do + dst="$target/overlays/$(basename "$ovr")" + copyForced "$ovr" "$dst" + kept[$dst]=1 + done + fi + + # Prune stale device trees / overlays. for fn in "$target"/*.dtb "$target"/overlays/*; do if [ "''${kept[$fn]:-}" != 1 ]; then From bc8333d8edb72fa012bb39029bd519bc90966c79 Mon Sep 17 00:00:00 2001 From: Jakob Leifhelm Date: Sun, 4 Oct 2026 15:48:26 +0200 Subject: [PATCH 24/24] mnt/reform: output formatted nix code --- mnt/reform/updateKernelPatches.nix | 2 +- mnt/reform/updateKernelPatches.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/mnt/reform/updateKernelPatches.nix b/mnt/reform/updateKernelPatches.nix index a21180ca..2bffbec6 100644 --- a/mnt/reform/updateKernelPatches.nix +++ b/mnt/reform/updateKernelPatches.nix @@ -11,5 +11,5 @@ in runCommand "mnt-reform-kernel-patches" { } '' shopt -s globstar cd ${reformDebianPackages} - echo "[ $(printf '"%s"' linux/patches${lib.versions.majorMinor sources.modDirVersion}/**/*.patch) ]" > $out + echo -e "[\n$(printf ' "%s"\n' linux/patches${lib.versions.majorMinor sources.modDirVersion}/**/*.patch)\n]"> $out '' diff --git a/mnt/reform/updateKernelPatches.sh b/mnt/reform/updateKernelPatches.sh index 73d4ef5a..8475acc0 100755 --- a/mnt/reform/updateKernelPatches.sh +++ b/mnt/reform/updateKernelPatches.sh @@ -2,4 +2,3 @@ nix build .#mnt-reform-kernel-patches cp result kernelPatches.nix -nix fmt kernelPatches.nix