1
0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-06-02 11:03:33 +02:00

Merge branch 'master' into lenovo/add/yoga-7-prox-14arh7

This commit is contained in:
mergify[bot] 2024-02-06 09:20:40 +00:00 committed by GitHub
commit 8e2fca0463
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 209 additions and 2 deletions

View File

@ -86,6 +86,8 @@ See code for all available configurations.
| [Asus ROG Strix G733QS](asus/rog-strix/g733qs) | `<nixos-hardware/asus/rog-strix/g733qs>` |
| [Asus ROG Zephyrus G14 GA401](asus/zephyrus/ga401) | `<nixos-hardware/asus/zephyrus/ga401>` |
| [Asus ROG Zephyrus G14 GA402](asus/zephyrus/ga402) | `<nixos-hardware/asus/zephyrus/ga402>` |
| [Asus ROG Zephyrus G14 GA402X* (2023)](asus/zephyrus/ga402x/amdgpu) | `<nixos-hardware/asus/zephyrus/ga402x/amdgpu>` |
| [Asus ROG Zephyrus G14 GA402X* (2023)](asus/zephyrus/ga402x/nvidia) | `<nixos-hardware/asus/zephyrus/ga402x/nvidia>` |
| [Asus ROG Zephyrus G15 GA502](asus/zephyrus/ga502) | `<nixos-hardware/asus/zephyrus/ga502>` |
| [Asus ROG Zephyrus G15 GA503](asus/zephyrus/ga503) | `<nixos-hardware/asus/zephyrus/ga503>` |
| [Asus ROG Zephyrus M16 GU603H](asus/zephyrus/gu603h) | `<nixos-hardware/asus/zephyrus/gu603h>` |
@ -246,7 +248,7 @@ See code for all available configurations.
| [Omen 15-en0010ca](omen/15-en0010ca) | `<nixos-hardware/omen/15-en0010ca>` |
| [Omen 16-n0005ne](omen/16-n0005ne) | `<nixos-hardware/omen/16-n0005ne>` |
| [Omen 15-en1007sa](omen/15-en1007sa) | `<nixos-hardware/omen/15-en1007sa>` |
| [Omen en00015p](omen/en00015p) | `<nixos-hardware/omen/en00015p>` |
| [Omen 15-en0002np](omen/15-en0002np) | `<nixos-hardware/omen/15-en0002np>` |
| [One-Netbook OneNetbook 4](onenetbook/4) | `<nixos-hardware/onenetbook/4>` |
| [Panasonic Let's Note CF-LX4](panasonic/letsnote/cf-lx4) | `<nixos-hardware/panasonic/letsnote/cf-lx4>` |
| [PC Engines APU](pcengines/apu) | `<nixos-hardware/pcengines/apu>` |

View File

@ -0,0 +1,58 @@
{ config,
lib,
pkgs,
...
}:
let
inherit (lib) mkDefault mkEnableOption mkIf mkMerge;
cfg = config.hardware.asus.zephyrus.ga402x;
in {
imports = [
../shared.nix
];
options.hardware.asus.zephyrus.ga402x.amdgpu = {
recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = false; };
sg_display.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = true; };
psr.enable = (mkEnableOption "Enable amdgpu.dcdebugmask=0x10 kernel boot param") // { default = true; };
};
config = mkMerge [
{
# AMD RX680
services.xserver.videoDrivers = mkDefault [ "amdgpu" ];
hardware = {
amdgpu.loadInInitrd = true;
opengl.extraPackages = with pkgs; [
vaapiVdpau
libvdpau-va-gl
];
};
}
(mkIf cfg.amdgpu.recovery.enable {
# Hopefully fixes for where the kernel sometimes hangs when suspending or hibernating
# (Though, I'm very suspicious of the Mediatek Wifi...)
boot.kernelParams = [
"amdgpu.gpu_recovery=1"
];
})
(mkIf (!cfg.amdgpu.sg_display.enable) {
# Can help solve flickering/glitching display issues since Scatter/Gather code was reenabled
boot.kernelParams = [
"amdgpu.sg_display=0"
];
})
(mkIf (!cfg.amdgpu.psr.enable) {
# Can help solve flickering/glitching display issues since Scatter/Gather code was reenabled
boot.kernelParams = [
"amdgpu.dcdebugmask=0x10"
];
})
];
}

View File

@ -0,0 +1,15 @@
## When using from a Flake, you can access these via imports of the attr key, e.g:
#
# imports = [
# nixos-hardware.nixosModules.asus-zephyrus-ga402x.amdgpu
# ];
#
## or:
# imports = [
# nixos-hardware.nixosModules.asus-zephyrus-ga402x.nvidia
# ];
{
amdgpu = import ./amdgpu;
nvidia = import ./nvidia;
}

View File

@ -0,0 +1,55 @@
{ lib,
pkgs,
...
}:
let
inherit (lib) mkDefault;
in {
imports = [
../shared.nix
## "prime.nix" loads this, aleady:
# ../../../common/gpu/nvidia
../../../../common/gpu/nvidia/prime.nix
];
# NVIDIA GeForce RTX 4060 Mobile
boot = {
blacklistedKernelModules = [ "nouveau" ];
};
# Also in nvidia/default.nix
services.xserver.videoDrivers = mkDefault [ "nvidia" ];
hardware = {
## Enable the Nvidia card, as well as Prime and Offload:
amdgpu.loadInInitrd = true;
opengl.extraPackages = with pkgs; [
# Also in nvidia/default.nix
vaapiVdpau
libvdpau-va-gl
];
nvidia = {
modesetting.enable = true;
nvidiaSettings = true;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
amdgpuBusId = "PCI:101:0:0";
nvidiaBusId = "PCI:1:0:0";
};
powerManagement = {
# This is unreliable on the 4060; works a few times, then hangs:
# enable = true;
# finegrained = true
};
};
};
}

View File

@ -0,0 +1,76 @@
{ config,
pkgs,
lib,
...
}:
let
inherit (lib) mkDefault mkIf mkMerge version versionOlder;
in {
imports = [
../../../common/cpu/amd
# Better power-savings from AMD PState:
../../../common/cpu/amd/pstate.nix
../../../common/gpu/amd
../../../common/pc/laptop
../../../common/pc/laptop/acpi_call.nix
../../../common/pc/ssd
];
config = mkMerge [
{
# Configure basic system settings:
boot = {
kernelModules = [ "kvm-amd" ];
kernelParams = [
"mem_sleep_default=deep"
"pcie_aspm.policy=powersupersave"
];
};
services = {
asusd = {
enable = mkDefault true;
enableUserService = mkDefault true;
};
supergfxd.enable = true;
udev = {
extraHwdb = ''
# Fixes mic mute button
evdev:name:*:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:*
KEYBOARD_KEY_ff31007c=f20
'';
extraRules = ''
# Disable auto-suspend for the ASUS N-KEY Device, i.e. USB Keyboard
# Otherwise, it will tend to take 1-2 key-presses to wake-up after suspending
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend", ATTR{idVendor}=="0b05", ATTR{idProduct}=="19b6", ATTR{power/autosuspend}="-1"
'';
};
};
}
(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;
};
};
})
];
}

View File

@ -21,6 +21,7 @@
asus-rog-strix-g733qs = import ./asus/rog-strix/g733qs;
asus-zephyrus-ga401 = import ./asus/zephyrus/ga401;
asus-zephyrus-ga402 = import ./asus/zephyrus/ga402;
asus-zephyrus-ga402x = import ./asus/zephyrus/ga402x;
asus-zephyrus-ga502 = import ./asus/zephyrus/ga502;
asus-zephyrus-ga503 = import ./asus/zephyrus/ga503;
asus-zephyrus-gu603h = import ./asus/zephyrus/gu603h;
@ -187,7 +188,7 @@
omen-15-en0010ca = import ./omen/15-en0010ca;
omen-16-n0005ne = import ./omen/16-n0005ne;
omen-15-en1007sa = import ./omen/15-en1007sa;
omen-en00015p = import ./omen/en00015p;
omen-15-en0002np = import ./omen/15-en0002np;
onenetbook-4 = import ./onenetbook/4;
olimex-teres_i = import ./olimex/teres_i;
pcengines-apu = import ./pcengines/apu;