at 24.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 "the asusd service for ASUS ROG laptops"; 10 11 package = lib.mkPackageOption pkgs "asusctl" { }; 12 13 enableUserService = lib.mkOption { 14 type = lib.types.bool; 15 default = false; 16 description = '' 17 Activate the asusd-user service. 18 ''; 19 }; 20 21 animeConfig = lib.mkOption { 22 type = lib.types.nullOr lib.types.str; 23 default = null; 24 description = '' 25 The content of /etc/asusd/anime.ron. 26 See https://asus-linux.org/asusctl/#anime-control. 27 ''; 28 }; 29 30 asusdConfig = lib.mkOption { 31 type = lib.types.nullOr lib.types.str; 32 default = null; 33 description = '' 34 The content of /etc/asusd/asusd.ron. 35 See https://asus-linux.org/asusctl/. 36 ''; 37 }; 38 39 auraConfig = lib.mkOption { 40 type = lib.types.nullOr lib.types.str; 41 default = null; 42 description = '' 43 The content of /etc/asusd/aura.ron. 44 See https://asus-linux.org/asusctl/#led-keyboard-control. 45 ''; 46 }; 47 48 profileConfig = lib.mkOption { 49 type = lib.types.nullOr lib.types.str; 50 default = null; 51 description = '' 52 The content of /etc/asusd/profile.ron. 53 See https://asus-linux.org/asusctl/#profiles. 54 ''; 55 }; 56 57 fanCurvesConfig = lib.mkOption { 58 type = lib.types.nullOr lib.types.str; 59 default = null; 60 description = '' 61 The content of /etc/asusd/fan_curves.ron. 62 See https://asus-linux.org/asusctl/#fan-curves. 63 ''; 64 }; 65 66 userLedModesConfig = lib.mkOption { 67 type = lib.types.nullOr lib.types.str; 68 default = null; 69 description = '' 70 The content of /etc/asusd/asusd-user-ledmodes.ron. 71 See https://asus-linux.org/asusctl/#led-keyboard-control. 72 ''; 73 }; 74 }; 75 }; 76 77 config = lib.mkIf cfg.enable { 78 environment.systemPackages = [ cfg.package ]; 79 80 environment.etc = 81 let 82 maybeConfig = name: cfg: lib.mkIf (cfg != null) { 83 source = pkgs.writeText name cfg; 84 mode = "0644"; 85 }; 86 in 87 { 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; 94 }; 95 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; 101 102 systemd.user.services.asusd-user.enable = cfg.enableUserService; 103 }; 104 105 meta.maintainers = pkgs.asusctl.meta.maintainers; 106}