2017-01-12 18:25:14 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
2018-05-06 19:26:37 +01:00
|
|
|
cfg = config.hardware.ckb-next;
|
2017-01-12 18:25:14 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
{
|
2019-12-10 01:51:19 +00:00
|
|
|
imports = [
|
|
|
|
(mkRenamedOptionModule [ "hardware" "ckb" "enable" ] [ "hardware" "ckb-next" "enable" ])
|
|
|
|
(mkRenamedOptionModule [ "hardware" "ckb" "package" ] [ "hardware" "ckb-next" "package" ])
|
|
|
|
];
|
|
|
|
|
2018-05-06 19:26:37 +01:00
|
|
|
options.hardware.ckb-next = {
|
2022-08-28 20:18:44 +01:00
|
|
|
enable = mkEnableOption (lib.mdDoc "the Corsair keyboard/mouse driver");
|
2017-01-12 18:25:14 +00:00
|
|
|
|
2018-01-19 23:56:44 +00:00
|
|
|
gid = mkOption {
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
default = null;
|
|
|
|
example = 100;
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2018-01-19 23:56:44 +00:00
|
|
|
Limit access to the ckb daemon to a particular group.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2017-01-12 18:25:14 +00:00
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
2018-05-06 19:26:37 +01:00
|
|
|
default = pkgs.ckb-next;
|
2021-10-03 17:06:03 +01:00
|
|
|
defaultText = literalExpression "pkgs.ckb-next";
|
2022-07-28 22:19:15 +01:00
|
|
|
description = lib.mdDoc ''
|
2017-01-12 18:25:14 +00:00
|
|
|
The package implementing the Corsair keyboard/mouse driver.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
|
2018-05-06 19:26:37 +01:00
|
|
|
systemd.services.ckb-next = {
|
2018-05-06 19:23:20 +01:00
|
|
|
description = "Corsair Keyboards and Mice Daemon";
|
2017-01-12 18:25:14 +00:00
|
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
serviceConfig = {
|
2018-01-19 23:56:44 +00:00
|
|
|
ExecStart = "${cfg.package}/bin/ckb-next-daemon ${optionalString (cfg.gid != null) "--gid=${builtins.toString cfg.gid}"}";
|
2018-05-06 19:23:20 +01:00
|
|
|
Restart = "on-failure";
|
2017-01-12 18:25:14 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
2022-10-04 18:06:48 +01:00
|
|
|
maintainers = with lib.maintainers; [ ];
|
2017-01-12 18:25:14 +00:00
|
|
|
};
|
|
|
|
}
|