nixos/services.tp-auto-kbbl: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-30 00:46:51 +02:00
parent d279b64dc1
commit 11904bba73

View File

@ -1,28 +1,25 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.tp-auto-kbbl;
in {
meta.maintainers = with maintainers; [ sebtm ];
meta.maintainers = with lib.maintainers; [ sebtm ];
options = {
services.tp-auto-kbbl = {
enable = mkEnableOption "auto toggle keyboard back-lighting on Thinkpads (and maybe other laptops) for Linux";
enable = lib.mkEnableOption "auto toggle keyboard back-lighting on Thinkpads (and maybe other laptops) for Linux";
package = mkPackageOption pkgs "tp-auto-kbbl" { };
package = lib.mkPackageOption pkgs "tp-auto-kbbl" { };
arguments = mkOption {
type = types.listOf types.str;
arguments = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = ''
List of arguments appended to `./tp-auto-kbbl --device [device] [arguments]`
'';
};
device = mkOption {
type = types.str;
device = lib.mkOption {
type = lib.types.str;
default = "/dev/input/event0";
description = "Device watched for activities.";
};
@ -30,12 +27,12 @@ in {
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
systemd.services.tp-auto-kbbl = {
serviceConfig = {
ExecStart = concatStringsSep " "
ExecStart = lib.concatStringsSep " "
([ "${cfg.package}/bin/tp-auto-kbbl" "--device ${cfg.device}" ] ++ cfg.arguments);
Restart = "always";
Type = "simple";