mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 09:17:14 +08:00 
			
		
		
		
	chore: format repo using treefmt-nix and nixfmt-rfc-style
This commit is contained in:
		@@ -1,4 +1,5 @@
 | 
			
		||||
{ config,
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
@@ -7,15 +8,22 @@ let
 | 
			
		||||
  inherit (lib) mkEnableOption mkIf mkMerge;
 | 
			
		||||
  cfg = config.hardware.asus.zephyrus.ga402x;
 | 
			
		||||
 | 
			
		||||
in {
 | 
			
		||||
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; };
 | 
			
		||||
    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 [
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
{ lib,
 | 
			
		||||
{
 | 
			
		||||
  lib,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
@@ -6,7 +7,8 @@
 | 
			
		||||
let
 | 
			
		||||
  inherit (lib) mkDefault;
 | 
			
		||||
 | 
			
		||||
in {
 | 
			
		||||
in
 | 
			
		||||
{
 | 
			
		||||
  imports = [
 | 
			
		||||
    ../shared.nix
 | 
			
		||||
    ## "prime.nix" loads this, aleady:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,24 @@
 | 
			
		||||
{ config,
 | 
			
		||||
{
 | 
			
		||||
  config,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  lib,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
 | 
			
		||||
let
 | 
			
		||||
  inherit (lib) mkDefault mkEnableOption mkIf mkMerge version versionAtLeast versionOlder;
 | 
			
		||||
  inherit (lib)
 | 
			
		||||
    mkDefault
 | 
			
		||||
    mkEnableOption
 | 
			
		||||
    mkIf
 | 
			
		||||
    mkMerge
 | 
			
		||||
    version
 | 
			
		||||
    versionAtLeast
 | 
			
		||||
    versionOlder
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
  cfg = config.hardware.asus.zephyrus.ga402x;
 | 
			
		||||
in {
 | 
			
		||||
in
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  imports = [
 | 
			
		||||
    ../../../common/cpu/amd
 | 
			
		||||
@@ -26,12 +36,12 @@ in {
 | 
			
		||||
    # enables it for kernel 6.9.x onwards.
 | 
			
		||||
    #
 | 
			
		||||
    # Note: the device name is "ASUS N-KEY Device".
 | 
			
		||||
    keyboard.autosuspend.enable = (
 | 
			
		||||
      mkEnableOption "Enable auto-suspend on the internal USB keyboard (ASUS N-KEY Device) on Zephyrus GA402X"
 | 
			
		||||
    ) // {
 | 
			
		||||
      default = versionAtLeast config.boot.kernelPackages.kernel.version "6.9";
 | 
			
		||||
      defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\"";
 | 
			
		||||
    };
 | 
			
		||||
    keyboard.autosuspend.enable =
 | 
			
		||||
      (mkEnableOption "Enable auto-suspend on the internal USB keyboard (ASUS N-KEY Device) on Zephyrus GA402X")
 | 
			
		||||
      // {
 | 
			
		||||
        default = versionAtLeast config.boot.kernelPackages.kernel.version "6.9";
 | 
			
		||||
        defaultText = lib.literalExpression "lib.versionAtLeast config.boot.kernelPackages.kernel.version \"6.9\"";
 | 
			
		||||
      };
 | 
			
		||||
    # The ASUS 8295 ITE device will cause an immediate wake-up when trying to suspend the laptop.
 | 
			
		||||
    # After the first successful hibernate, it will work as expected, however.
 | 
			
		||||
    # NOTE: I'm not actually sure what this device, as neither the touchpad nor the M1-M4 keys cause a wake-up.
 | 
			
		||||
@@ -67,7 +77,7 @@ in {
 | 
			
		||||
      };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    (mkIf (! cfg.keyboard.autosuspend.enable) {
 | 
			
		||||
    (mkIf (!cfg.keyboard.autosuspend.enable) {
 | 
			
		||||
      services.udev.extraRules = ''
 | 
			
		||||
        # Disable power auto-suspend for the ASUS N-KEY device, i.e. USB Keyboard.
 | 
			
		||||
        # Otherwise on certain kernel-versions, it will tend to take 1-2 key-presses to wake-up after the device suspends.
 | 
			
		||||
@@ -75,7 +85,7 @@ in {
 | 
			
		||||
      '';
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    (mkIf (! cfg.ite-device.wakeup.enable) {
 | 
			
		||||
    (mkIf (!cfg.ite-device.wakeup.enable) {
 | 
			
		||||
      services.udev.extraRules = ''
 | 
			
		||||
        # Disable power wakeup for the 8295 ITE device.
 | 
			
		||||
        # Otherwise on certain kernel-versions, it will tend to cause the laptop to immediately wake-up when suspending.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user