nixpkgs/nixos/modules/services/hardware/asusd.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

105 lines
3.1 KiB
Nix
Raw Normal View History

2022-09-16 17:23:46 +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");
enableUserService = lib.mkOption {
type = lib.types.bool;
default = false;
description = lib.mdDoc ''
Activate the asusd-user service.
'';
};
animeConfig = lib.mkOption {
2023-04-29 17:00:55 +00:00
type = lib.types.nullOr lib.types.str;
default = null;
2022-09-16 17:23:46 +00:00
description = lib.mdDoc ''
2023-04-29 17:00:55 +00:00
The content of /etc/asusd/anime.ron.
2022-09-16 17:23:46 +00:00
See https://asus-linux.org/asusctl/#anime-control.
'';
};
asusdConfig = lib.mkOption {
2023-04-29 17:00:55 +00:00
type = lib.types.nullOr lib.types.str;
default = null;
2022-09-16 17:23:46 +00:00
description = lib.mdDoc ''
2023-04-29 17:00:55 +00:00
The content of /etc/asusd/asusd.ron.
2022-09-16 17:23:46 +00:00
See https://asus-linux.org/asusctl/.
'';
};
auraConfig = lib.mkOption {
2023-04-29 17:00:55 +00:00
type = lib.types.nullOr lib.types.str;
default = null;
2022-09-16 17:23:46 +00:00
description = lib.mdDoc ''
2023-04-29 17:00:55 +00:00
The content of /etc/asusd/aura.ron.
2022-09-16 17:23:46 +00:00
See https://asus-linux.org/asusctl/#led-keyboard-control.
'';
};
profileConfig = lib.mkOption {
type = lib.types.nullOr lib.types.str;
2023-04-29 17:00:55 +00:00
default = null;
2022-09-16 17:23:46 +00:00
description = lib.mdDoc ''
2023-04-29 17:00:55 +00:00
The content of /etc/asusd/profile.ron.
2022-09-16 17:23:46 +00:00
See https://asus-linux.org/asusctl/#profiles.
'';
};
2023-04-29 17:00:55 +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-09-16 17:23:46 +00:00
'';
};
userLedModesConfig = lib.mkOption {
2023-04-29 17:00:55 +00:00
type = lib.types.nullOr lib.types.str;
2022-09-16 17:23:46 +00:00
default = null;
description = lib.mdDoc ''
2023-04-29 17:00:55 +00:00
The content of /etc/asusd/asusd-user-ledmodes.ron.
2022-09-16 17:23:46 +00:00
See https://asus-linux.org/asusctl/#led-keyboard-control.
'';
};
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.asusctl ];
environment.etc =
let
2023-04-29 17:00:55 +00:00
maybeConfig = name: cfg: lib.mkIf (cfg != null) {
source = pkgs.writeText name cfg;
2022-09-16 17:23:46 +00:00
mode = "0644";
};
in
{
2023-04-29 17:00:55 +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-09-16 17:23:46 +00:00
};
services.dbus.enable = true;
systemd.packages = [ pkgs.asusctl ];
services.dbus.packages = [ pkgs.asusctl ];
services.udev.packages = [ pkgs.asusctl ];
services.supergfxd.enable = lib.mkDefault true;
2022-09-16 17:23:46 +00:00
systemd.user.services.asusd-user.enable = cfg.enableUserService;
};
meta.maintainers = pkgs.asusctl.meta.maintainers;
}