From c21024523e6c9cd04fa9cf83c5df208b67926a73 Mon Sep 17 00:00:00 2001 From: Dom Rodriguez Date: Sat, 26 Sep 2026 20:33:44 +0100 Subject: [PATCH] fix(gpd): de-dupe hardware.gpd.ppt module between duo and win-max-2 Both devices defined their own copy of options.hardware.gpd.ppt, which collides when every module is imported together (breaks search.nuschtos.de). Move the shared module to gpd/ppt.nix and have both devices import it. --- gpd/duo/duo-specific/bluetooth.nix | 2 +- gpd/duo/duo-specific/power/default.nix | 2 +- gpd/{duo/duo-specific/power => }/ppt.nix | 4 ++ gpd/win-max-2/default.nix | 68 +----------------------- 4 files changed, 8 insertions(+), 68 deletions(-) rename gpd/{duo/duo-specific/power => }/ppt.nix (91%) diff --git a/gpd/duo/duo-specific/bluetooth.nix b/gpd/duo/duo-specific/bluetooth.nix index 01a167b2..bdc530b9 100644 --- a/gpd/duo/duo-specific/bluetooth.nix +++ b/gpd/duo/duo-specific/bluetooth.nix @@ -9,7 +9,7 @@ lib, pkgs, ... -# TODO: drop this if linux 6.11 goes EOL + # TODO: drop this if linux 6.11 goes EOL }: with lib; mkIf diff --git a/gpd/duo/duo-specific/power/default.nix b/gpd/duo/duo-specific/power/default.nix index eb5a5d0a..814ae900 100644 --- a/gpd/duo/duo-specific/power/default.nix +++ b/gpd/duo/duo-specific/power/default.nix @@ -1,6 +1,6 @@ { imports = [ - ./ppt.nix + ../../../ppt.nix ./power-saving.nix ]; } diff --git a/gpd/duo/duo-specific/power/ppt.nix b/gpd/ppt.nix similarity index 91% rename from gpd/duo/duo-specific/power/ppt.nix rename to gpd/ppt.nix index 4efb73f2..ffbf2a56 100644 --- a/gpd/duo/duo-specific/power/ppt.nix +++ b/gpd/ppt.nix @@ -9,6 +9,10 @@ let cfg = config.hardware.gpd.ppt; in { + # Linux default PPT is 24-22-22, BIOS default PPT is 35-32-28. It can be controlled by ryzenadj. + + # NOTICE: Whenever you can limit PPT to 15W by pressing Fn + Shift to enter quiet mode. + options.hardware.gpd.ppt = { enable = mkEnableOption "Enable PPT control for device by ryzenadj." // { # Default increase PPT to the BIOS default when power adapter plugin to increase performance. diff --git a/gpd/win-max-2/default.nix b/gpd/win-max-2/default.nix index c9762cd6..47e2dbe6 100644 --- a/gpd/win-max-2/default.nix +++ b/gpd/win-max-2/default.nix @@ -1,72 +1,8 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; -let - cfg = config.hardware.gpd.ppt; -in -{ +{ ... }: { imports = [ ../../common/pc/laptop ../../common/pc/ssd ../../common/hidpi.nix + ../ppt.nix ]; - - # Linux default PPT is 24-22-22, BIOS default PPT is 35-32-28. It can be controlled by ryzenadj. - - # NOTICE: Whenever you can limit PPT to 15W by pressing Fn + Shift to enter quiet mode. - - options.hardware.gpd.ppt = { - enable = mkEnableOption "Enable PPT control for device by ryzenadj." // { - # Default increase PPT to the BIOS default when power adapter plugin to increase performance. - default = true; - }; - - adapter = { - fast-limit = mkOption { - description = "Fast PTT Limit(milliwatt) when power adapter plugin."; - default = 35000; - type = types.ints.unsigned; - }; - slow-limit = mkOption { - description = "Slow PTT Limit(milliwatt) when power adapter plugin."; - default = 32000; - type = types.ints.unsigned; - }; - stapm-limit = mkOption { - description = "Stapm PTT Limit(milliwatt) when power adapter plugin."; - default = 28000; - type = types.ints.unsigned; - }; - }; - - battery = { - fast-limit = mkOption { - description = "Fast PTT Limit(milliwatt) when using battery."; - default = 24000; - type = types.ints.unsigned; - }; - slow-limit = mkOption { - description = "Slow PTT Limit(milliwatt) when using battery."; - default = 22000; - type = types.ints.unsigned; - }; - stapm-limit = mkOption { - description = "Stapm PTT Limit(milliwatt) when using battery."; - default = 22000; - type = types.ints.unsigned; - }; - }; - }; - - config = mkIf cfg.enable { - environment.systemPackages = [ pkgs.ryzenadj ]; - services.udev.extraRules = '' - SUBSYSTEM=="power_supply", KERNEL=="ADP1", ATTR{online}=="1", RUN+="${pkgs.ryzenadj}/bin/ryzenadj --stapm-limit ${toString cfg.adapter.stapm-limit} --fast-limit ${toString cfg.adapter.fast-limit} --slow-limit ${toString cfg.adapter.slow-limit}" - SUBSYSTEM=="power_supply", KERNEL=="ADP1", ATTR{online}=="0", RUN+="${pkgs.ryzenadj}/bin/ryzenadj --stapm-limit ${toString cfg.battery.stapm-limit} --fast-limit ${toString cfg.battery.fast-limit} --slow-limit ${toString cfg.battery.slow-limit}" - ''; - }; }