From 8fa4a6c59796619384e69c31a5198c471d3cce46 Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Sun, 13 Oct 2024 11:32:19 +0200 Subject: [PATCH 1/3] asusd: support multiple aura configs Since version 6.0.0 asusd supports multiple aura devices. Since each of them may have a different configuration, the `aura.ron` file, previously used for configuration, is now ignored in favor of device specific `aura_{prod_id}.ron` configuration. This change adds support for specifying multiple aura configs via `auraConfigs` attribute and removes the old `auraConfig` attribute. --- nixos/modules/services/hardware/asusd.nix | 28 ++++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/hardware/asusd.nix b/nixos/modules/services/hardware/asusd.nix index 316164562b80d..33433b016740f 100644 --- a/nixos/modules/services/hardware/asusd.nix +++ b/nixos/modules/services/hardware/asusd.nix @@ -9,6 +9,20 @@ let cfg = config.services.asusd; in { + imports = [ + (lib.mkRemovedOptionModule + [ + "services" + "asusd" + "auraConfig" + ] + '' + This option has been replaced by `services.asusd.auraConfigs' because asusd + supports multiple aura devices since version 6.0.0. + '' + ) + ]; + options = { services.asusd = { enable = lib.mkEnableOption "the asusd service for ASUS ROG laptops"; @@ -41,11 +55,11 @@ in ''; }; - auraConfig = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; + auraConfigs = lib.mkOption { + type = lib.types.attrsOf lib.types.str; + default = { }; description = '' - The content of /etc/asusd/aura.ron. + The content of /etc/asusd/aura_.ron. See https://asus-linux.org/asusctl/#led-keyboard-control. ''; }; @@ -94,11 +108,13 @@ in { "asusd/anime.ron" = maybeConfig "anime.ron" cfg.animeConfig; "asusd/asusd.ron" = maybeConfig "asusd.ron" cfg.asusdConfig; - "asusd/aura.ron" = maybeConfig "aura.ron" cfg.auraConfig; "asusd/profile.ron" = maybeConfig "profile.ron" cfg.profileConfig; "asusd/fan_curves.ron" = maybeConfig "fan_curves.ron" cfg.fanCurvesConfig; "asusd/asusd_user_ledmodes.ron" = maybeConfig "asusd_user_ledmodes.ron" cfg.userLedModesConfig; - }; + } + // lib.attrsets.concatMapAttrs (prod_id: value: { + "asusd/aura_${prod_id}.ron" = maybeConfig "aura_${prod_id}.ron" value; + }) cfg.auraConfigs; services.dbus.enable = true; systemd.packages = [ cfg.package ]; From 1d2118f727f2d15fce2f7b4be569901dde517ba4 Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Sun, 22 Dec 2024 15:55:29 +0100 Subject: [PATCH 2/3] asusd: allow specifying configs via paths --- nixos/modules/services/hardware/asusd.nix | 148 +++++++++++++--------- 1 file changed, 86 insertions(+), 62 deletions(-) diff --git a/nixos/modules/services/hardware/asusd.nix b/nixos/modules/services/hardware/asusd.nix index 33433b016740f..07b39bce64f4a 100644 --- a/nixos/modules/services/hardware/asusd.nix +++ b/nixos/modules/services/hardware/asusd.nix @@ -24,73 +24,95 @@ in ]; options = { - services.asusd = { - enable = lib.mkEnableOption "the asusd service for ASUS ROG laptops"; + services.asusd = + with lib.types; + let + configType = submodule ( + { text, source, ... }: + { + options = { + text = lib.mkOption { + default = null; + type = nullOr lines; + description = "Text of the file."; + }; - package = lib.mkPackageOption pkgs "asusctl" { }; + source = lib.mkOption { + default = null; + type = nullOr path; + description = "Path of the source file."; + }; + }; + } + ); + in + { + enable = lib.mkEnableOption "the asusd service for ASUS ROG laptops"; - enableUserService = lib.mkOption { - type = lib.types.bool; - default = false; - description = '' - Activate the asusd-user service. - ''; - }; + package = lib.mkPackageOption pkgs "asusctl" { }; - animeConfig = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - description = '' - The content of /etc/asusd/anime.ron. - See https://asus-linux.org/asusctl/#anime-control. - ''; - }; + enableUserService = lib.mkOption { + type = bool; + default = false; + description = '' + Activate the asusd-user service. + ''; + }; - asusdConfig = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - description = '' - The content of /etc/asusd/asusd.ron. - See https://asus-linux.org/asusctl/. - ''; - }; + animeConfig = lib.mkOption { + type = nullOr configType; + default = null; + description = '' + The content of /etc/asusd/anime.ron. + See https://asus-linux.org/asusctl/#anime-control. + ''; + }; - auraConfigs = lib.mkOption { - type = lib.types.attrsOf lib.types.str; - default = { }; - description = '' - The content of /etc/asusd/aura_.ron. - See https://asus-linux.org/asusctl/#led-keyboard-control. - ''; - }; + asusdConfig = lib.mkOption { + type = nullOr configType; + default = null; + description = '' + The content of /etc/asusd/asusd.ron. + See https://asus-linux.org/asusctl/. + ''; + }; - profileConfig = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - description = '' - The content of /etc/asusd/profile.ron. - See https://asus-linux.org/asusctl/#profiles. - ''; - }; + auraConfigs = lib.mkOption { + type = attrsOf configType; + default = { }; + description = '' + The content of /etc/asusd/aura_.ron. + See https://asus-linux.org/asusctl/#led-keyboard-control. + ''; + }; - fanCurvesConfig = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - description = '' - The content of /etc/asusd/fan_curves.ron. - See https://asus-linux.org/asusctl/#fan-curves. - ''; - }; + profileConfig = lib.mkOption { + type = nullOr configType; + default = null; + description = '' + The content of /etc/asusd/profile.ron. + See https://asus-linux.org/asusctl/#profiles. + ''; + }; + + fanCurvesConfig = lib.mkOption { + type = nullOr configType; + default = null; + description = '' + The content of /etc/asusd/fan_curves.ron. + See https://asus-linux.org/asusctl/#fan-curves. + ''; + }; - userLedModesConfig = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - description = '' - The content of /etc/asusd/asusd-user-ledmodes.ron. - See https://asus-linux.org/asusctl/#led-keyboard-control. - ''; + userLedModesConfig = lib.mkOption { + type = nullOr configType; + default = null; + description = '' + The content of /etc/asusd/asusd-user-ledmodes.ron. + See https://asus-linux.org/asusctl/#led-keyboard-control. + ''; + }; }; - }; }; config = lib.mkIf cfg.enable { @@ -100,10 +122,12 @@ in let maybeConfig = name: cfg: - lib.mkIf (cfg != null) { - source = pkgs.writeText name cfg; - mode = "0644"; - }; + lib.mkIf (cfg != null) ( + (if (cfg.source != null) then { source = cfg.source; } else { text = cfg.text; }) + // { + mode = "0644"; + } + ); in { "asusd/anime.ron" = maybeConfig "anime.ron" cfg.animeConfig; From 3d2a98c916f58325f92b83df4f4dab4c54b569a8 Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Thu, 26 Dec 2024 10:32:25 +0100 Subject: [PATCH 3/3] asusd: add release note about breaking changes --- nixos/doc/manual/release-notes/rl-2505.section.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nixos/doc/manual/release-notes/rl-2505.section.md b/nixos/doc/manual/release-notes/rl-2505.section.md index 5ce521657c936..b93714d07dcde 100644 --- a/nixos/doc/manual/release-notes/rl-2505.section.md +++ b/nixos/doc/manual/release-notes/rl-2505.section.md @@ -86,6 +86,12 @@ - `ps3-disc-dumper` was updated to 4.2.5, which removed the CLI project and now exclusively offers the GUI +- `asusd` has been upgraded to version 6 which supports multiple aura devices. To account for this, the single `auraConfig` configuration option has been replaced with `auraConfigs` which is an attribute set of config options per each device. The config files may also be now specified as either source files or text strings; to account for this you will need to specify that `text` is used for your existing configs, e.g.: + ```diff + -services.asusd.asusdConfig = '''file contents''' + +services.asusd.asusdConfig.text = '''file contents''' + ``` + - `timescaledb` requires manual upgrade steps. After you run ALTER EXTENSION, you must run [this SQL script](https://github.com/timescale/timescaledb-extras/blob/master/utils/2.15.X-fix_hypertable_foreign_keys.sql). For more details, see the following pull requests [#6797](https://github.com/timescale/timescaledb/pull/6797). PostgreSQL 13 is no longer supported in TimescaleDB v2.16.