git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #140045 from SebTM/add_tp-auto-kbbl

tp-auto-kbbl: init at 0.1.5

commit598ad679d8d6e5d00b1565191dc69780c2347be9 authorMaximilian Bosch <maximilian@mbosch.me> dateFri 1 Oct 2021, 19:59 (5 years ago) parent107a594f0d1af9
4 files changed+94
nixos/modules/module-list.nix+1 nixos/modules/services/misc/tp-auto-kbbl.nix+58 pkgs/tools/system/tp-auto-kbbl/default.nix+33 pkgs/top-level/all-packages.nix+2
nixos/modules/module-list.nix+1
@@ -593,6 +593,7 @@
593593 ./services/misc/sysprof.nix
594594 ./services/misc/taskserver
595595 ./services/misc/tiddlywiki.nix
596+ ./services/misc/tp-auto-kbbl.nix
596597 ./services/misc/tzupdate.nix
597598 ./services/misc/uhub.nix
598599 ./services/misc/weechat.nix
nixos/modules/services/misc/tp-auto-kbbl.nixnew file+58
@@ -0,0 +1,58 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let cfg = config.services.tp-auto-kbbl;
6+
7+in {
8+ meta.maintainers = with maintainers; [ sebtm ];
9+
10+ options = {
11+ services.tp-auto-kbbl = {
12+ enable = mkEnableOption "Auto toggle keyboard back-lighting on Thinkpads (and maybe other laptops) for Linux";
13+
14+ package = mkOption {
15+ type = types.package;
16+ default = pkgs.tp-auto-kbbl;
17+ defaultText = literalExample "pkgs.tp-auto-kbbl";
18+ description = "Package providing <command>tp-auto-kbbl</command>.";
19+ };
20+
21+ arguments = mkOption {
22+ type = types.listOf types.str;
23+ default = [ ];
24+ description = ''
25+ List of arguments appended to <literal>./tp-auto-kbbl --device [device] [arguments]</literal>
26+ '';
27+ };
28+
29+ device = mkOption {
30+ type = types.str;
31+ default = "/dev/input/event0";
32+ description = "Device watched for activities.";
33+ };
34+
35+ };
36+ };
37+
38+ config = mkIf cfg.enable {
39+ environment.systemPackages = [ cfg.package ];
40+
41+ systemd.services.tp-auto-kbbl = {
42+ serviceConfig = {
43+ ExecStart = concatStringsSep " "
44+ ([ "${cfg.package}/bin/tp-auto-kbbl" "--device ${cfg.device}" ] ++ cfg.arguments);
45+ Restart = "always";
46+ Type = "simple";
47+ };
48+
49+ unitConfig = {
50+ Description = "Auto toggle keyboard backlight";
51+ Documentation = "https://github.com/saibotd/tp-auto-kbbl";
52+ After = [ "dbus.service" ];
53+ };
54+
55+ wantedBy = [ "multi-user.target" ];
56+ };
57+ };
58+}
pkgs/tools/system/tp-auto-kbbl/default.nixnew file+33
@@ -0,0 +1,33 @@
1+{ lib
2+, fetchFromGitHub
3+, rustPlatform
4+, dbus
5+, pkg-config
6+, openssl
7+, libevdev
8+}:
9+
10+rustPlatform.buildRustPackage rec {
11+ pname = "tp-auto-kbbl";
12+ version = "0.1.5";
13+
14+ src = fetchFromGitHub {
15+ owner = "saibotd";
16+ repo = pname;
17+ rev = version;
18+ sha256 = "0db9h15zyz2sq5r1qmq41288i54rhdl30qy08snpsh6sx2q4443y";
19+ };
20+
21+ cargoSha256 = "0m1gcvshbd9cfb0v6f86kbcfjxb4p9cxynmxgi4nxkhaszfyf56c";
22+
23+ nativeBuildInputs = [ pkg-config ];
24+ buildInputs = [ dbus libevdev openssl ];
25+
26+ meta = with lib; {
27+ description = "Auto toggle keyboard back-lighting on Thinkpads (and maybe other laptops) for Linux";
28+ homepage = "https://github.com/saibotd/tp-auto-kbbl";
29+ license = licenses.mit;
30+ maintainers = with maintainers; [ sebtm ];
31+ platforms = platforms.linux;
32+ };
33+}
pkgs/top-level/all-packages.nix+2
@@ -32337,6 +32337,8 @@ with pkgs;
3233732337
3233832338 thinkfan = callPackage ../tools/system/thinkfan { };
3233932339
32340+ tp-auto-kbbl = callPackage ../tools/system/tp-auto-kbbl { };
32341+
3234032342 tup = callPackage ../development/tools/build-managers/tup { };
3234132343
3234232344 tusk = callPackage ../applications/office/tusk { };