diff --git a/README.md b/README.md index 91f95d9..ce0523b 100644 --- a/README.md +++ b/README.md @@ -421,6 +421,7 @@ See code for all available configurations. | [Radxa ROCK 5 Model B](radxa/rock-5b) | `` | `rock-5b` | | [Radxa ROCK Pi 4](radxa/rock-pi-4) | `` | `rock-pi-4` | | [Radxa ROCK Pi E](radxa/rock-pi-e) | `` | `rock-pi-e` | +| [Razer Blade 14 (RZ09-0530)](razer/blade/14/RZ09-0530) | `` | `razer-blade-14-RZ09-0530` | | [Raspberry Pi 2](raspberry-pi/2) | `` | `raspberry-pi-2` | | [Raspberry Pi 3](raspberry-pi/3) | `` | `raspberry-pi-3` | | [Raspberry Pi 4](raspberry-pi/4) | `` | `raspberry-pi-4` | diff --git a/common/wifi/mediatek/mt7925/default.nix b/common/wifi/mediatek/mt7925/default.nix new file mode 100644 index 0000000..6929823 --- /dev/null +++ b/common/wifi/mediatek/mt7925/default.nix @@ -0,0 +1,80 @@ +# MediaTek MT7925 WiFi 7 / Bluetooth support +# +# The MT7925 is a WiFi 7 (802.11be) + Bluetooth combo chip found in many +# 2024-2025 laptops. It requires specific workarounds for stable operation. +# +# Known issues: +# - Power management causes random disconnections +# - ASPM (Active State Power Management) causes hangs +# - CLC (Country Location Code) causes 6GHz band instability +# - WiFi often fails to reconnect after suspend/resume +# - wpa_supplicant has issues; iwd is recommended +# +# Devices using MT7925: +# - Razer Blade 14 (RZ09-0530) 2025 +# - ThinkPad P16s Gen 4 +# - Other 2024-2025 laptops with WiFi 7 +# +# References: +# - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2118755 +# - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2133863 +{ + lib, + pkgs, + ... +}: + +{ + # =========================================================================== + # Kernel Recommendation + # =========================================================================== + # Kernel 6.18+ is recommended for stable MT7925 operation. + # Earlier kernels may have driver bugs causing disconnections or hangs. + # Set: boot.kernelPackages = pkgs.linuxPackages_latest; + + # =========================================================================== + # Kernel Module Parameters + # =========================================================================== + # Disable power management at driver level during module load + boot.extraModprobeConfig = '' + # MT7925 WiFi - disable all power management for stability + options mt7925e disable_aspm=1 + options mt7925e power_save=0 + + # Disable CLC (Country Location Code) - fixes 6GHz band stability + options mt7925-common disable_clc=1 + ''; + + # =========================================================================== + # NetworkManager Configuration + # =========================================================================== + networking.networkmanager.wifi = { + # Disable WiFi power saving (causes disconnections) + powersave = lib.mkDefault false; + + # Consistent MAC during scans (randomization causes issues) + scanRandMacAddress = lib.mkDefault false; + }; + + # =========================================================================== + # Suspend/Resume Fix + # =========================================================================== + # Restart NetworkManager after suspend to clear stale driver state + systemd.services.mediatek-wifi-resume = { + description = "Restart NetworkManager after suspend to fix MediaTek WiFi"; + wantedBy = [ + "suspend.target" + "hibernate.target" + "hybrid-sleep.target" + ]; + after = [ + "suspend.target" + "hibernate.target" + "hybrid-sleep.target" + ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.systemd}/bin/systemctl restart NetworkManager.service"; + }; + }; +} diff --git a/common/wifi/mediatek/mt7925/iwd.nix b/common/wifi/mediatek/mt7925/iwd.nix new file mode 100644 index 0000000..2cf35bf --- /dev/null +++ b/common/wifi/mediatek/mt7925/iwd.nix @@ -0,0 +1,34 @@ +# MediaTek MT7925 - iwd backend configuration +# +# Use iwd instead of wpa_supplicant for MT7925. iwd provides better +# stability and faster roaming for WiFi 7 chips. +# +# Import this alongside default.nix: +# imports = [ +# ../common/wifi/mediatek/mt7925 +# ../common/wifi/mediatek/mt7925/iwd.nix +# ]; +{ lib, ... }: + +{ + # Required for iwd to work with MT7925 - includes non-redistributable firmware + hardware.enableAllFirmware = lib.mkDefault true; + + # Use iwd backend instead of wpa_supplicant + networking.networkmanager.wifi.backend = lib.mkDefault "iwd"; + + # iwd configuration for MT7925 stability + networking.wireless.iwd.settings = { + General = { + # Consistent MAC per network (fixes WPA3 handshake issues) + AddressRandomization = "network"; + + # Let NetworkManager handle IP configuration, not iwd + # (prevents conflicts between iwd and NetworkManager) + EnableNetworkConfiguration = false; + }; + Settings = { + AutoConnect = true; + }; + }; +} diff --git a/flake.nix b/flake.nix index 48ffb4a..529812a 100644 --- a/flake.nix +++ b/flake.nix @@ -389,6 +389,7 @@ purism-librem-13v3 = import ./purism/librem/13v3; purism-librem-15v3 = import ./purism/librem/15v3; purism-librem-5r4 = import ./purism/librem/5r4; + razer-blade-14-RZ09-0530 = import ./razer/blade/14/RZ09-0530; raspberry-pi-2 = import ./raspberry-pi/2; raspberry-pi-3 = import ./raspberry-pi/3; raspberry-pi-4 = import ./raspberry-pi/4; diff --git a/razer/blade/14/RZ09-0530/README.md b/razer/blade/14/RZ09-0530/README.md new file mode 100644 index 0000000..92a270b --- /dev/null +++ b/razer/blade/14/RZ09-0530/README.md @@ -0,0 +1,68 @@ +# Razer Blade 14 (RZ09-0530) + +Model year: 2025 + +## Hardware Specifications + +- **Model:** RZ09-0530 +- **CPU:** AMD Ryzen AI 9 HX 370 (Strix Point) +- **iGPU:** AMD Radeon 880M / 890M +- **dGPU:** NVIDIA GeForce RTX 5060 Max-Q (Blackwell) +- **Display:** 14" 2560x1600 OLED, 240Hz + +## Identifying Your Model + +```bash +nix-shell -p dmidecode --run "sudo dmidecode -s system-product-name" +# Should output: Blade 14 - RZ09-0530 +``` + +## Usage + +```nix +{ + imports = [ + inputs.nixos-hardware.nixosModules.razer-blade-14-RZ09-0530 + ]; +} +``` + +## Features + +This profile configures: + +- AMD CPU with microcode updates +- NVIDIA Prime offload (use `nvidia-offload` command for GPU-intensive applications) +- AMD iGPU for early KMS +- Power management for hybrid graphics +- Proper PCI bus IDs for the hybrid GPU setup + +## Optional: OpenRazer for RGB Control + +If you want to control the Razer RGB keyboard lighting, you can enable OpenRazer: + +```nix +{ + hardware.openrazer = { + enable = true; + # Disable keyStatistics if using a keyboard remapper like kanata + keyStatistics = false; + users = [ "your-username" ]; + }; + + # Optional: Polychromatic GUI for RGB control + environment.systemPackages = [ pkgs.polychromatic ]; +} +``` + +## Known Issues + +- None reported yet + +## Additional Notes + +- The NVIDIA RTX 5060 Max-Q uses the Blackwell architecture and works with the open kernel modules (`hardware.nvidia.open = true`) +- Fine-grained power management is enabled by default for better battery life +- Use `nvidia-offload ` to run applications on the discrete GPU + + diff --git a/razer/blade/14/RZ09-0530/default.nix b/razer/blade/14/RZ09-0530/default.nix new file mode 100644 index 0000000..9b57604 --- /dev/null +++ b/razer/blade/14/RZ09-0530/default.nix @@ -0,0 +1,60 @@ +{ config, lib, ... }: + +let + inherit (lib) mkDefault; +in +{ + imports = [ + ../../../../common/cpu/amd + ../../../../common/gpu/amd + ../../../../common/gpu/nvidia/prime.nix + ../../../../common/pc/laptop + ../../../../common/pc/ssd + ../../../../common/wifi/mediatek/mt7925 + ../../../../common/wifi/mediatek/mt7925/iwd.nix + ]; + + # Razer Blade 14 (RZ09-0530 / 2025) - AMD Ryzen AI 9 HX 370 + NVIDIA RTX 5060 Max-Q + + # Enable AMD iGPU and NVIDIA dGPU drivers + services.xserver.videoDrivers = mkDefault [ + "amdgpu" + "nvidia" + ]; + + hardware = { + # Firmware for AMD CPU/GPU, WiFi, Bluetooth + enableRedistributableFirmware = mkDefault true; + + # Enable AMD iGPU in initrd for early KMS + amdgpu.initrd.enable = mkDefault true; + + nvidia = { + modesetting.enable = mkDefault true; + nvidiaSettings = mkDefault true; + + # Open kernel modules work on Blackwell (RTX 50 series) + open = mkDefault true; + + prime = { + offload = { + enable = mkDefault true; + enableOffloadCmd = mkDefault true; + }; + + # Bus IDs for Razer Blade 14 2025 + # Obtained via: nix shell nixpkgs#pciutils -c lspci -d ::03xx + # c4:00.0 (196:0:0) - NVIDIA GeForce RTX 5060 Max-Q + # c5:00.0 (197:0:0) - AMD Radeon 880M / 890M + amdgpuBusId = "PCI:197:0:0"; + nvidiaBusId = "PCI:196:0:0"; + }; + + # Power management for hybrid graphics + powerManagement = { + enable = mkDefault true; + finegrained = mkDefault true; + }; + }; + }; +}