at 23.11-pre 3.1 kB view raw
1{ config, lib, pkgs, ... }: 2 3let 4 cfg = config.services.asusd; 5in 6{ 7 options = { 8 services.asusd = { 9 enable = lib.mkEnableOption (lib.mdDoc "the asusd service for ASUS ROG laptops"); 10 11 enableUserService = lib.mkOption { 12 type = lib.types.bool; 13 default = false; 14 description = lib.mdDoc '' 15 Activate the asusd-user service. 16 ''; 17 }; 18 19 animeConfig = lib.mkOption { 20 type = lib.types.nullOr lib.types.str; 21 default = null; 22 description = lib.mdDoc '' 23 The content of /etc/asusd/anime.ron. 24 See https://asus-linux.org/asusctl/#anime-control. 25 ''; 26 }; 27 28 asusdConfig = lib.mkOption { 29 type = lib.types.nullOr lib.types.str; 30 default = null; 31 description = lib.mdDoc '' 32 The content of /etc/asusd/asusd.ron. 33 See https://asus-linux.org/asusctl/. 34 ''; 35 }; 36 37 auraConfig = lib.mkOption { 38 type = lib.types.nullOr lib.types.str; 39 default = null; 40 description = lib.mdDoc '' 41 The content of /etc/asusd/aura.ron. 42 See https://asus-linux.org/asusctl/#led-keyboard-control. 43 ''; 44 }; 45 46 profileConfig = lib.mkOption { 47 type = lib.types.nullOr lib.types.str; 48 default = null; 49 description = lib.mdDoc '' 50 The content of /etc/asusd/profile.ron. 51 See https://asus-linux.org/asusctl/#profiles. 52 ''; 53 }; 54 55 fanCurvesConfig = lib.mkOption { 56 type = lib.types.nullOr lib.types.str; 57 default = null; 58 description = lib.mdDoc '' 59 The content of /etc/asusd/fan_curves.ron. 60 See https://asus-linux.org/asusctl/#fan-curves. 61 ''; 62 }; 63 64 userLedModesConfig = lib.mkOption { 65 type = lib.types.nullOr lib.types.str; 66 default = null; 67 description = lib.mdDoc '' 68 The content of /etc/asusd/asusd-user-ledmodes.ron. 69 See https://asus-linux.org/asusctl/#led-keyboard-control. 70 ''; 71 }; 72 }; 73 }; 74 75 config = lib.mkIf cfg.enable { 76 environment.systemPackages = [ pkgs.asusctl ]; 77 78 environment.etc = 79 let 80 maybeConfig = name: cfg: lib.mkIf (cfg != null) { 81 source = pkgs.writeText name cfg; 82 mode = "0644"; 83 }; 84 in 85 { 86 "asusd/anime.ron" = maybeConfig "anime.ron" cfg.animeConfig; 87 "asusd/asusd.ron" = maybeConfig "asusd.ron" cfg.asusdConfig; 88 "asusd/aura.ron" = maybeConfig "aura.ron" cfg.auraConfig; 89 "asusd/profile.conf" = maybeConfig "profile.ron" cfg.profileConfig; 90 "asusd/fan_curves.ron" = maybeConfig "fan_curves.ron" cfg.fanCurvesConfig; 91 "asusd/asusd_user_ledmodes.ron" = maybeConfig "asusd_user_ledmodes.ron" cfg.userLedModesConfig; 92 }; 93 94 services.dbus.enable = true; 95 systemd.packages = [ pkgs.asusctl ]; 96 services.dbus.packages = [ pkgs.asusctl ]; 97 services.udev.packages = [ pkgs.asusctl ]; 98 services.supergfxd.enable = lib.mkDefault true; 99 100 systemd.user.services.asusd-user.enable = cfg.enableUserService; 101 }; 102 103 meta.maintainers = pkgs.asusctl.meta.maintainers; 104}