nixpkgs/nixos/modules/services/hardware/asusd.nix
stuebinm 6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07:00

107 lines
3.0 KiB
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.services.asusd;
in
{
options = {
services.asusd = {
enable = lib.mkEnableOption "the asusd service for ASUS ROG laptops";
package = lib.mkPackageOption pkgs "asusctl" { };
enableUserService = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Activate the asusd-user service.
'';
};
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.
'';
};
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/.
'';
};
auraConfig = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = ''
The content of /etc/asusd/aura.ron.
See https://asus-linux.org/asusctl/#led-keyboard-control.
'';
};
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.
'';
};
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.
'';
};
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.
'';
};
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
environment.etc =
let
maybeConfig = name: cfg: lib.mkIf (cfg != null) {
source = pkgs.writeText name cfg;
mode = "0644";
};
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.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;
};
services.dbus.enable = true;
systemd.packages = [ cfg.package ];
services.dbus.packages = [ cfg.package ];
services.udev.packages = [ cfg.package ];
services.supergfxd.enable = lib.mkDefault true;
systemd.user.services.asusd-user.enable = cfg.enableUserService;
};
meta.maintainers = pkgs.asusctl.meta.maintainers;
}