1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7let
8 cfg = config.services.g810-led;
9in
10{
11 options = {
12 services.g810-led = {
13 enable = lib.mkEnableOption "g810-led, a Linux LED controller for some Logitech G Keyboards";
14
15 package = lib.mkPackageOption pkgs "g810-led" { };
16
17 profile = lib.mkOption {
18 type = lib.types.nullOr lib.types.lines;
19 default = null;
20 example = ''
21 # G810-LED Profile (turn all keys on)
22
23 # Set all keys on
24 a ffffff
25
26 # Commit changes
27 c
28 '';
29 description = ''
30 Keyboard profile to apply at boot time.
31
32 The upstream repository provides [example configurations](https://github.com/MatMoul/g810-led/tree/master/sample_profiles).
33 '';
34 };
35 };
36 };
37
38 config = lib.mkIf cfg.enable {
39 environment.etc."g810-led/profile".text = lib.mkIf (cfg.profile != null) cfg.profile;
40
41 services.udev.packages = [ cfg.package ];
42 };
43
44 meta.maintainers = with lib.maintainers; [ GaetanLepage ];
45}