chore: format repo using treefmt-nix and nixfmt-rfc-style

This commit is contained in:
Andre
2025-06-04 12:11:03 -04:00
parent fc7c471412
commit 51e51e6014
266 changed files with 3721 additions and 2733 deletions

View File

@@ -11,5 +11,7 @@
# 6.5 adds many fixes and improvements for the Ally
# This includes for example performance, audio and bluetooth
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.5") (lib.mkDefault pkgs.linuxPackages_latest);
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.5") (
lib.mkDefault pkgs.linuxPackages_latest
);
}

View File

@@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
p = pkgs.writeScriptBin "charge-upto" ''
echo ''${0:-100} > /sys/class/power_supply/BAT?/charge_control_end_threshold
@@ -22,8 +27,14 @@ in
config = {
environment.systemPackages = lib.mkIf cfg.enableChargeUptoScript [ p ];
systemd.services.battery-charge-threshold = {
wantedBy = [ "local-fs.target" "suspend.target" ];
after = [ "local-fs.target" "suspend.target" ];
wantedBy = [
"local-fs.target"
"suspend.target"
];
after = [
"local-fs.target"
"suspend.target"
];
description = "Set the battery charge threshold to ${toString cfg.chargeUpto}%";
startLimitBurst = 5;
startLimitIntervalSec = 1;

View File

@@ -3,7 +3,8 @@
pkgs,
config,
...
}: {
}:
{
imports = [
../../common/cpu/amd
../../common/cpu/amd/raphael/igpu.nix
@@ -20,7 +21,9 @@
# The bottom 2 parts are taken from the framework 16-inch laptops configurations.
# Workaround for SuspendThenHibernate: https://lore.kernel.org/linux-kernel/20231106162310.85711-1-mario.limonciello@amd.com/
boot.kernelParams = lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8") ["rtc_cmos.use_acpi_alarm=1"];
boot.kernelParams =
lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "6.8")
[ "rtc_cmos.use_acpi_alarm=1" ];
# AMD has better battery life with PPD over TLP:
# https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13

View File

@@ -1,16 +1,16 @@
{ ... }:
{
imports = [
../../common/cpu/amd
../../common/gpu/nvidia/prime.nix
../../common/gpu/nvidia/ampere
../../common/pc/laptop
../../common/pc/ssd
];
imports = [
../../common/cpu/amd
../../common/gpu/nvidia/prime.nix
../../common/gpu/nvidia/ampere
../../common/pc/laptop
../../common/pc/ssd
];
hardware.nvidia.prime = {
amdgpuBusId = "PCI:5:0:0";
nvidiaBusId = "PCI:1:0:0";
};
}
hardware.nvidia.prime = {
amdgpuBusId = "PCI:5:0:0";
nvidiaBusId = "PCI:1:0:0";
};
}

View File

@@ -1,4 +1,5 @@
{ config,
{
config,
lib,
...
}:
@@ -7,15 +8,22 @@ let
inherit (lib) mkEnableOption mkIf mkMerge;
cfg = config.hardware.asus.flow.gv302x;
in {
in
{
imports = [
../shared.nix
];
options.hardware.asus.flow.gv302x.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 [

View File

@@ -1,4 +1,5 @@
{ lib,
{
lib,
pkgs,
config,
...
@@ -7,7 +8,8 @@
let
inherit (lib) mkDefault;
in {
in
{
imports = [
../shared.nix
## "prime.nix" loads this, aleady:
@@ -23,8 +25,6 @@ in {
blacklistedKernelModules = [ "nouveau" ];
};
hardware = {
## Enable the Nvidia card, as well as Prime and Offload:
amdgpu.initrd.enable = mkDefault true;
@@ -49,7 +49,7 @@ in {
};
dynamicBoost.enable = mkDefault true;
};
};
}

View File

@@ -1,14 +1,23 @@
{ config,
{
config,
pkgs,
lib,
...
}:
let
inherit (lib) mkDefault mkEnableOption mkIf mkMerge version versionAtLeast versionOlder;
inherit (lib)
mkDefault
mkEnableOption
mkIf
mkMerge
version
versionAtLeast
;
cfg = config.hardware.asus.flow.gv302x;
in {
in
{
imports = [
../../../common/cpu/amd
@@ -26,12 +35,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 Flow GV302X"
) // {
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 Flow GV302X")
// {
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.
@@ -63,7 +72,7 @@ in {
evdev:name:*:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:*
KEYBOARD_KEY_ff31007c=f20
'';
};
};
};
#flow devices are 2 in 1 laptops
@@ -71,7 +80,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.
@@ -79,7 +88,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.

View File

@@ -2,7 +2,7 @@
{
imports = [
../../common/cpu/intel
../../common/pc/laptop
../../common/pc/laptop
];
#Nouveau doesn't work at all on this model.

View File

@@ -1,8 +1,7 @@
{ config, lib, ... }:
{
imports =
[
imports = [
../../common/cpu/intel
../../common/gpu/nvidia
../../common/gpu/nvidia/prime.nix
@@ -11,14 +10,12 @@
../battery.nix
];
hardware.nvidia =
{
hardware.nvidia = {
modesetting.enable = lib.mkDefault true;
open = lib.mkIf (lib.versionAtLeast config.hardware.nvidia.package.version "555") true;
prime =
{
intelBusId = "PCI:0:2:0";
prime = {
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};

View File

@@ -1,17 +1,17 @@
{
imports = [
../../../common/cpu/amd
../../../common/cpu/amd/pstate.nix
../../../common/gpu/nvidia
../../../common/gpu/nvidia/prime.nix
../../../common/gpu/nvidia/ampere
../../../common/pc/laptop
../../../common/pc/ssd
../../battery.nix
];
imports = [
../../../common/cpu/amd
../../../common/cpu/amd/pstate.nix
../../../common/gpu/nvidia
../../../common/gpu/nvidia/prime.nix
../../../common/gpu/nvidia/ampere
../../../common/pc/laptop
../../../common/pc/ssd
../../battery.nix
];
hardware.nvidia.prime = {
amdgpuBusId = "PCI:05:00:0";
nvidiaBusId = "PCI:01:00:0";
};
hardware.nvidia.prime = {
amdgpuBusId = "PCI:05:00:0";
nvidiaBusId = "PCI:01:00:0";
};
}

View File

@@ -13,5 +13,5 @@
hardware.nvidia.prime = {
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
}

View File

@@ -1,16 +1,16 @@
{
imports = [
../../../common/cpu/amd
../../../common/cpu/amd/pstate.nix
../../../common/gpu/nvidia
../../../common/gpu/nvidia/prime.nix
../../../common/gpu/nvidia/ampere
../../../common/pc/laptop
../../../common/pc/ssd
../../battery.nix
];
imports = [
../../../common/cpu/amd
../../../common/cpu/amd/pstate.nix
../../../common/gpu/nvidia
../../../common/gpu/nvidia/prime.nix
../../../common/gpu/nvidia/ampere
../../../common/pc/laptop
../../../common/pc/ssd
../../battery.nix
];
hardware.nvidia.prime = {
hardware.nvidia.prime = {
amdgpuBusId = "PCI:5:0:0";
nvidiaBusId = "PCI:1:0:0";
};

View File

@@ -20,7 +20,9 @@
options snd-hda-intel patch=hda-jack-retask.fw
'';
# before 5.12 it would interpret every keystroke as the power button
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") (lib.mkDefault pkgs.linuxPackages_latest);
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "5.12") (
lib.mkDefault pkgs.linuxPackages_latest
);
hardware.nvidia.prime = {
amdgpuBusId = "PCI:5:0:0";

View File

@@ -1,4 +1,4 @@
{lib, ...}:
{ lib, ... }:
{
imports = [
../shared.nix
@@ -7,11 +7,11 @@
];
hardware.nvidia = {
prime = {
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:2:0:0";
};
prime = {
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:2:0:0";
};
dynamicBoost.enable = lib.mkForce false; # Dynamic boost is not supported on Pascal architeture
dynamicBoost.enable = lib.mkForce false; # Dynamic boost is not supported on Pascal architeture
};
}

View File

@@ -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 [

View File

@@ -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:

View File

@@ -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.