1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 cfg = config.hardware.ckb;
7
8in
9 {
10 options.hardware.ckb = {
11 enable = mkEnableOption "the Corsair keyboard/mouse driver";
12
13 package = mkOption {
14 type = types.package;
15 default = pkgs.ckb;
16 defaultText = "pkgs.ckb";
17 description = ''
18 The package implementing the Corsair keyboard/mouse driver.
19 '';
20 };
21 };
22
23 config = mkIf cfg.enable {
24 environment.systemPackages = [ cfg.package ];
25
26 systemd.services.ckb = {
27 description = "Corsair Keyboard Daemon";
28 wantedBy = ["multi-user.target"];
29 script = "${cfg.package}/bin/ckb-daemon";
30 serviceConfig = {
31 Restart = "always";
32 StandardOutput = "syslog";
33 };
34 };
35 };
36
37 meta = {
38 maintainers = with lib.maintainers; [ kierdavis ];
39 };
40 }