From fd83b9479c1a73e5dde8bb301bf0449182f3a7e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 25 Nov 2025 13:59:36 +0100 Subject: [PATCH] framework-16-amd-ai-300-series: add nvidia submodule Add a dedicated submodule for Framework Laptop 16 AMD AI 300 Series with NVIDIA dGPU (RTX 5070). This provides hybrid graphics configuration with PRIME offload, allowing the AMD iGPU to run by default for better battery life while making the NVIDIA dGPU available on demand via nvidia-offload. Exposed as nixosModules.framework-16-amd-ai-300-series-nvidia Co-authored-by: Daniel Schaefer --- flake.nix | 1 + framework/16-inch/amd-ai-300-series/README.md | 34 ++++++++++++++++--- .../amd-ai-300-series/nvidia/default.nix | 28 +++++++++++++++ 3 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 framework/16-inch/amd-ai-300-series/nvidia/default.nix diff --git a/flake.nix b/flake.nix index e8dce483..42e0d88c 100644 --- a/flake.nix +++ b/flake.nix @@ -173,6 +173,7 @@ framework-amd-ai-300-series = import ./framework/13-inch/amd-ai-300-series; framework-16-7040-amd = import ./framework/16-inch/7040-amd; framework-16-amd-ai-300-series = import ./framework/16-inch/amd-ai-300-series; + framework-16-amd-ai-300-series-nvidia = import ./framework/16-inch/amd-ai-300-series/nvidia; framework-desktop-amd-ai-max-300-series = import ./framework/desktop/amd-ai-max-300-series; friendlyarm-nanopc-t4 = import ./friendlyarm/nanopc-t4; friendlyarm-nanopi-r5s = import ./friendlyarm/nanopi-r5s; diff --git a/framework/16-inch/amd-ai-300-series/README.md b/framework/16-inch/amd-ai-300-series/README.md index 1c0cc41d..d05fa878 100644 --- a/framework/16-inch/amd-ai-300-series/README.md +++ b/framework/16-inch/amd-ai-300-series/README.md @@ -1,14 +1,40 @@ # [Framework Laptop 16 AMD AI 300 Series](https://frame.work/) -## nvidia +## NVIDIA dGPU Module -If you have an nvidia dGPU module, you can enable it via the nvidia open drivers: +If you have an NVIDIA dGPU module (GeForce RTX 5070 or similar), use the nvidia submodule: +```nix +{ + imports = [ + nixos-hardware.nixosModules.framework-16-amd-ai-300-series-nvidia + ]; +} ``` -services.xserver.videoDrivers = [ "nvidia" ]; -hardware.nvidia.open = true; # see the note above + +This enables hybrid graphics with PRIME offload: the AMD iGPU runs by default for better battery life, and the NVIDIA dGPU can be used on demand with `nvidia-offload `. + +**IMPORTANT:** You MUST override the PCI bus IDs for your specific system. The default values are examples only and will likely not match your hardware. Due to Framework 16's modular design, bus IDs vary depending on installed expansion cards and NVMe drives: + +```nix +{ + hardware.nvidia.prime = { + amdgpuBusId = "PCI:195:0:0"; # Adjust to your system + nvidiaBusId = "PCI:194:0:0"; # Adjust to your system + }; +} ``` +Find your bus IDs with: + +```sh +$ lspci | grep -E "VGA|3D|Display" +c2:00.0 VGA compatible controller: NVIDIA Corporation ... +c3:00.0 Display controller: Advanced Micro Devices ... +``` + +Convert the hex bus ID to decimal (e.g., `c2:00.0` → `PCI:194:0:0`, `c3:00.0` → `PCI:195:0:0`). + See also [NVIDIA](https://wiki.nixos.org/wiki/NVIDIA) on the NixOS Wiki. ## Updating Firmware diff --git a/framework/16-inch/amd-ai-300-series/nvidia/default.nix b/framework/16-inch/amd-ai-300-series/nvidia/default.nix new file mode 100644 index 00000000..16b197ec --- /dev/null +++ b/framework/16-inch/amd-ai-300-series/nvidia/default.nix @@ -0,0 +1,28 @@ +{ lib, ... }: + +{ + imports = [ + ../. + ../../../../common/gpu/nvidia/blackwell + ../../../../common/gpu/nvidia/prime.nix + ]; + + # Explicitly set nvidia as video driver to override modesetting from AMD module + services.xserver.videoDrivers = [ "nvidia" ]; + + hardware.nvidia = { + # Hybrid graphics with PRIME offload for better battery life + # AMD iGPU by default, NVIDIA dGPU on demand via nvidia-offload command + prime = { + # WARNING: These defaults may not match your system! + # Bus IDs vary depending on installed expansion cards and NVMe drives. + # You MUST override these values - see README.md for instructions. + # Bus IDs can be found with `lspci | grep -E "VGA|3D|Display"` + amdgpuBusId = lib.mkDefault "PCI:195:0:0"; + nvidiaBusId = lib.mkDefault "PCI:194:0:0"; + }; + + # Power management for hybrid graphics + powerManagement.enable = lib.mkDefault true; + }; +}