2022-12-17 10:02:37 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.asusd;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
services.asusd = {
|
|
|
|
enable = lib.mkEnableOption (lib.mdDoc "the asusd service for ASUS ROG laptops");
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
package = lib.mkPackageOption pkgs "asusctl" { };
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
enableUserService = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = false;
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
Activate the asusd-user service.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
animeConfig = lib.mkOption {
|
2023-05-24 13:37:59 +00:00
|
|
|
type = lib.types.nullOr lib.types.str;
|
|
|
|
default = null;
|
2022-12-17 10:02:37 +00:00
|
|
|
description = lib.mdDoc ''
|
2023-05-24 13:37:59 +00:00
|
|
|
The content of /etc/asusd/anime.ron.
|
2022-12-17 10:02:37 +00:00
|
|
|
See https://asus-linux.org/asusctl/#anime-control.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
asusdConfig = lib.mkOption {
|
2023-05-24 13:37:59 +00:00
|
|
|
type = lib.types.nullOr lib.types.str;
|
|
|
|
default = null;
|
2022-12-17 10:02:37 +00:00
|
|
|
description = lib.mdDoc ''
|
2023-05-24 13:37:59 +00:00
|
|
|
The content of /etc/asusd/asusd.ron.
|
2022-12-17 10:02:37 +00:00
|
|
|
See https://asus-linux.org/asusctl/.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
auraConfig = lib.mkOption {
|
2023-05-24 13:37:59 +00:00
|
|
|
type = lib.types.nullOr lib.types.str;
|
|
|
|
default = null;
|
2022-12-17 10:02:37 +00:00
|
|
|
description = lib.mdDoc ''
|
2023-05-24 13:37:59 +00:00
|
|
|
The content of /etc/asusd/aura.ron.
|
2022-12-17 10:02:37 +00:00
|
|
|
See https://asus-linux.org/asusctl/#led-keyboard-control.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
profileConfig = lib.mkOption {
|
|
|
|
type = lib.types.nullOr lib.types.str;
|
2023-05-24 13:37:59 +00:00
|
|
|
default = null;
|
2022-12-17 10:02:37 +00:00
|
|
|
description = lib.mdDoc ''
|
2023-05-24 13:37:59 +00:00
|
|
|
The content of /etc/asusd/profile.ron.
|
2022-12-17 10:02:37 +00:00
|
|
|
See https://asus-linux.org/asusctl/#profiles.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
fanCurvesConfig = lib.mkOption {
|
|
|
|
type = lib.types.nullOr lib.types.str;
|
|
|
|
default = null;
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
The content of /etc/asusd/fan_curves.ron.
|
|
|
|
See https://asus-linux.org/asusctl/#fan-curves.
|
2022-12-17 10:02:37 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
userLedModesConfig = lib.mkOption {
|
2023-05-24 13:37:59 +00:00
|
|
|
type = lib.types.nullOr lib.types.str;
|
2022-12-17 10:02:37 +00:00
|
|
|
default = null;
|
|
|
|
description = lib.mdDoc ''
|
2023-05-24 13:37:59 +00:00
|
|
|
The content of /etc/asusd/asusd-user-ledmodes.ron.
|
2022-12-17 10:02:37 +00:00
|
|
|
See https://asus-linux.org/asusctl/#led-keyboard-control.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
2024-02-29 20:09:43 +00:00
|
|
|
environment.systemPackages = [ cfg.package ];
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
environment.etc =
|
|
|
|
let
|
2023-05-24 13:37:59 +00:00
|
|
|
maybeConfig = name: cfg: lib.mkIf (cfg != null) {
|
|
|
|
source = pkgs.writeText name cfg;
|
2022-12-17 10:02:37 +00:00
|
|
|
mode = "0644";
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
2023-05-24 13:37:59 +00:00
|
|
|
"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.conf" = 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;
|
2022-12-17 10:02:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.dbus.enable = true;
|
2024-02-29 20:09:43 +00:00
|
|
|
systemd.packages = [ cfg.package ];
|
|
|
|
services.dbus.packages = [ cfg.package ];
|
|
|
|
services.udev.packages = [ cfg.package ];
|
2022-12-17 10:02:37 +00:00
|
|
|
services.supergfxd.enable = lib.mkDefault true;
|
|
|
|
|
|
|
|
systemd.user.services.asusd-user.enable = cfg.enableUserService;
|
|
|
|
};
|
|
|
|
|
|
|
|
meta.maintainers = pkgs.asusctl.meta.maintainers;
|
|
|
|
}
|