1 { config, lib, pkgs, ... }:
5 let cfg = config.services.tp-auto-kbbl;
8 meta.maintainers = with maintainers; [ sebtm ];
11 services.tp-auto-kbbl = {
12 enable = mkEnableOption (lib.mdDoc "Auto toggle keyboard back-lighting on Thinkpads (and maybe other laptops) for Linux");
16 default = pkgs.tp-auto-kbbl;
17 defaultText = literalExpression "pkgs.tp-auto-kbbl";
18 description = lib.mdDoc "Package providing {command}`tp-auto-kbbl`.";
21 arguments = mkOption {
22 type = types.listOf types.str;
24 description = lib.mdDoc ''
25 List of arguments appended to `./tp-auto-kbbl --device [device] [arguments]`
31 default = "/dev/input/event0";
32 description = lib.mdDoc "Device watched for activities.";
38 config = mkIf cfg.enable {
39 environment.systemPackages = [ cfg.package ];
41 systemd.services.tp-auto-kbbl = {
43 ExecStart = concatStringsSep " "
44 ([ "${cfg.package}/bin/tp-auto-kbbl" "--device ${cfg.device}" ] ++ cfg.arguments);
50 Description = "Auto toggle keyboard backlight";
51 Documentation = "https://github.com/saibotd/tp-auto-kbbl";
52 After = [ "dbus.service" ];
55 wantedBy = [ "multi-user.target" ];