1 { config, lib, pkgs, ... }:
4 cfg = config.services.asusd;
9 enable = lib.mkEnableOption "the asusd service for ASUS ROG laptops";
11 package = lib.mkPackageOption pkgs "asusctl" { };
13 enableUserService = lib.mkOption {
14 type = lib.types.bool;
17 Activate the asusd-user service.
21 animeConfig = lib.mkOption {
22 type = lib.types.nullOr lib.types.str;
25 The content of /etc/asusd/anime.ron.
26 See https://asus-linux.org/asusctl/#anime-control.
30 asusdConfig = lib.mkOption {
31 type = lib.types.nullOr lib.types.str;
34 The content of /etc/asusd/asusd.ron.
35 See https://asus-linux.org/asusctl/.
39 auraConfig = lib.mkOption {
40 type = lib.types.nullOr lib.types.str;
43 The content of /etc/asusd/aura.ron.
44 See https://asus-linux.org/asusctl/#led-keyboard-control.
48 profileConfig = lib.mkOption {
49 type = lib.types.nullOr lib.types.str;
52 The content of /etc/asusd/profile.ron.
53 See https://asus-linux.org/asusctl/#profiles.
57 fanCurvesConfig = lib.mkOption {
58 type = lib.types.nullOr lib.types.str;
61 The content of /etc/asusd/fan_curves.ron.
62 See https://asus-linux.org/asusctl/#fan-curves.
66 userLedModesConfig = lib.mkOption {
67 type = lib.types.nullOr lib.types.str;
70 The content of /etc/asusd/asusd-user-ledmodes.ron.
71 See https://asus-linux.org/asusctl/#led-keyboard-control.
77 config = lib.mkIf cfg.enable {
78 environment.systemPackages = [ cfg.package ];
82 maybeConfig = name: cfg: lib.mkIf (cfg != null) {
83 source = pkgs.writeText name cfg;
88 "asusd/anime.ron" = maybeConfig "anime.ron" cfg.animeConfig;
89 "asusd/asusd.ron" = maybeConfig "asusd.ron" cfg.asusdConfig;
90 "asusd/aura.ron" = maybeConfig "aura.ron" cfg.auraConfig;
91 "asusd/profile.conf" = maybeConfig "profile.ron" cfg.profileConfig;
92 "asusd/fan_curves.ron" = maybeConfig "fan_curves.ron" cfg.fanCurvesConfig;
93 "asusd/asusd_user_ledmodes.ron" = maybeConfig "asusd_user_ledmodes.ron" cfg.userLedModesConfig;
96 services.dbus.enable = true;
97 systemd.packages = [ cfg.package ];
98 services.dbus.packages = [ cfg.package ];
99 services.udev.packages = [ cfg.package ];
100 services.supergfxd.enable = lib.mkDefault true;
102 systemd.user.services.asusd-user.enable = cfg.enableUserService;
105 meta.maintainers = pkgs.asusctl.meta.maintainers;