From 51de9fe52b7674a720fdafd385eb803ae7d9cada Mon Sep 17 00:00:00 2001 From: caleb Date: Sat, 16 Nov 2024 18:20:31 -0500 Subject: [PATCH] added zephyrus g14 (2024) - ga403 --- asus/zephyrus/ga403/default.nix | 89 +++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 asus/zephyrus/ga403/default.nix diff --git a/asus/zephyrus/ga403/default.nix b/asus/zephyrus/ga403/default.nix new file mode 100644 index 0000000..3c4f962 --- /dev/null +++ b/asus/zephyrus/ga403/default.nix @@ -0,0 +1,89 @@ +{ config, + pkgs, + lib, + ... +}: + +let + inherit (lib) mkDefault; +in { + + imports = [ + ../../../common/cpu/amd + ../../../common/cpu/amd/pstate.nix + ../../../common/gpu/amd + ../../../common/pc/laptop + ../../../common/pc/laptop/acpi_call.nix + ../../../common/pc/ssd + ../../../../common/gpu/nvidia/prime.nix + ../../../../common/gpu/nvidia/ada-lovelace + ]; + + # Configure basic system settings: + boot = { + kernelPackages = mkDefault pkgs.linuxPackages_latest; + kernelModules = [ "kvm-amd" ]; + kernelParams = [ + "mem_sleep_default=deep" + "pcie_aspm.policy=powersupersave" + ]; + }; + + services = { + asusd = { + enable = mkDefault true; + enableUserService = mkDefault true; + }; + + supergfxd.enable = mkDefault true; + }; + + (mkIf (versionOlder version "23.11") { + # See https://asus-linux.org/wiki/nixos/ for info about some problems + # detecting the dGPU: + systemd.services.supergfxd.path = [ pkgs.pciutils ]; + }) + + (mkIf (config.networking.wireless.iwd.enable && config.networking.wireless.scanOnLowSignal) { + # Meditek doesn't seem to be quite sensitive enough on the default roaming settings: + # https://wiki.archlinux.org/title/Wpa_supplicant#Roaming + # https://wiki.archlinux.org/title/Iwd#iwd_keeps_roaming + # + # But NixOS doesn't have the tweaks for IWD, yet. + networking.wireless.iwd.settings = { + General = { + RoamThreshold = -75; + RoamThreshold5G = -80; + RoamRetryInterval = 20; + }; + }; + }) + + # Enable the Nvidia card, as well as Prime and Offload: NVIDIA GeForce RTX 4060 Mobile + boot.blacklistedKernelModules = [ "nouveau" ]; + + services.xserver.videoDrivers = mkDefault [ "nvidia" ]; + + hardware = { + amdgpu.initrd.enable = mkDefault true; + + nvidia = { + modesetting.enable = true; + nvidiaSettings = mkDefault true; + + prime = { + offload = { + enable = mkDefault true; + enableOffloadCmd = mkDefault true; + }; + amdgpuBusId = "PCI:101:0:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + + powerManagement = { + enable = true; + finegrained = true + }; + }; + }; +} \ No newline at end of file