1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-12-29 04:59:45 +01:00
nixos-hardware/asus/zephyrus/ga403/default.nix

88 lines
2.2 KiB
Nix
Raw Normal View History

2024-11-17 00:20:31 +01:00
{ config,
pkgs,
lib,
...
}:
let
2024-11-18 18:23:09 +01:00
inherit (lib) mkDefault mkEnableOption mkIf mkMerge mkForce version versionAtLeast versionOlder;
2024-11-17 00:20:31 +01:00
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
2024-11-18 18:23:09 +01:00
../../../common/gpu/nvidia/prime.nix
../../../common/gpu/nvidia/ada-lovelace
2024-11-17 00:20:31 +01:00
];
2024-11-17 00:43:28 +01:00
config = mkMerge [
{
# Configure basic system settings:
boot = {
2024-11-18 18:23:09 +01:00
kernelPackages = mkDefault pkgs.linuxPackages_latest;
2024-11-17 00:43:28 +01:00
kernelModules = [ "kvm-amd" ];
kernelParams = [
"mem_sleep_default=deep"
"pcie_aspm.policy=powersupersave"
];
};
2024-11-17 00:20:31 +01:00
2024-11-17 00:43:28 +01:00
services = {
asusd = {
enable = mkDefault true;
enableUserService = mkDefault true;
};
2024-11-17 00:20:31 +01:00
2024-11-17 00:43:28 +01:00
supergfxd.enable = mkDefault true;
2024-11-17 00:20:31 +01:00
};
2024-11-17 00:43:28 +01:00
# Enable the Nvidia card, as well as Prime and Offload: NVIDIA GeForce RTX 4060 Mobile
boot.blacklistedKernelModules = [ "nouveau" ];
2024-11-17 00:20:31 +01:00
2024-11-18 18:23:09 +01:00
services.xserver.videoDrivers = mkForce [ "amdgpu" "nvidia" ];
2024-11-17 00:20:31 +01:00
2024-11-17 00:43:28 +01:00
hardware = {
amdgpu.initrd.enable = mkDefault true;
2024-11-17 00:20:31 +01:00
2024-11-17 00:43:28 +01:00
nvidia = {
modesetting.enable = true;
nvidiaSettings = mkDefault true;
2024-11-17 00:20:31 +01:00
2024-11-17 00:43:28 +01:00
prime = {
offload = {
enable = mkDefault true;
enableOffloadCmd = mkDefault true;
};
amdgpuBusId = "PCI:101:0:0";
nvidiaBusId = "PCI:1:0:0";
};
powerManagement = {
enable = true;
2024-11-18 18:23:09 +01:00
finegrained = true;
2024-11-17 00:43:28 +01:00
};
2024-11-17 00:20:31 +01:00
};
};
2024-11-17 00:43:28 +01:00
}
(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;
};
2024-11-17 00:20:31 +01:00
};
2024-11-17 00:43:28 +01:00
})
];
2024-11-18 18:23:09 +01:00
}