1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 cfg = config.hardware.ckb-next;
7
8in
9 {
10 imports = [
11 (mkRenamedOptionModule [ "hardware" "ckb" "enable" ] [ "hardware" "ckb-next" "enable" ])
12 (mkRenamedOptionModule [ "hardware" "ckb" "package" ] [ "hardware" "ckb-next" "package" ])
13 ];
14
15 options.hardware.ckb-next = {
16 enable = mkEnableOption "the Corsair keyboard/mouse driver";
17
18 gid = mkOption {
19 type = types.nullOr types.int;
20 default = null;
21 example = 100;
22 description = ''
23 Limit access to the ckb daemon to a particular group.
24 '';
25 };
26
27 package = mkPackageOption pkgs "ckb-next" { };
28 };
29
30 config = mkIf cfg.enable {
31 environment.systemPackages = [ cfg.package ];
32
33 systemd.services.ckb-next = {
34 description = "Corsair Keyboards and Mice Daemon";
35 wantedBy = ["multi-user.target"];
36 serviceConfig = {
37 ExecStart = "${cfg.package}/bin/ckb-next-daemon ${optionalString (cfg.gid != null) "--gid=${builtins.toString cfg.gid}"}";
38 Restart = "on-failure";
39 };
40 };
41 };
42
43 meta = {
44 maintainers = with lib.maintainers; [ ];
45 };
46 }