2017-01-12 18:25:14 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
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 02:51:19 +01:00
|
|
|
imports = [
|
2024-08-27 20:42:51 +02:00
|
|
|
(lib.mkRenamedOptionModule [ "hardware" "ckb" "enable" ] [ "hardware" "ckb-next" "enable" ])
|
|
|
|
(lib.mkRenamedOptionModule [ "hardware" "ckb" "package" ] [ "hardware" "ckb-next" "package" ])
|
2019-12-10 02:51:19 +01:00
|
|
|
];
|
|
|
|
|
2018-05-06 19:26:37 +01:00
|
|
|
options.hardware.ckb-next = {
|
2024-08-27 20:42:51 +02:00
|
|
|
enable = lib.mkEnableOption "the Corsair keyboard/mouse driver";
|
2017-01-12 18:25:14 +00:00
|
|
|
|
2024-08-27 20:42:51 +02:00
|
|
|
gid = lib.mkOption {
|
|
|
|
type = lib.types.nullOr lib.types.int;
|
2018-01-19 23:56:44 +00:00
|
|
|
default = null;
|
|
|
|
example = 100;
|
|
|
|
description = ''
|
|
|
|
Limit access to the ckb daemon to a particular group.
|
|
|
|
'';
|
2017-01-12 18:25:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
package = lib.mkPackageOption pkgs "ckb-next" { };
|
2024-12-10 20:26:33 +01:00
|
|
|
};
|
2017-01-12 18:25:14 +00:00
|
|
|
|
2024-08-27 20:42:51 +02:00
|
|
|
config = lib.mkIf cfg.enable {
|
2017-01-12 18:25:14 +00:00
|
|
|
environment.systemPackages = [ cfg.package ];
|
2024-12-10 20:26:33 +01:00
|
|
|
|
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 = {
|
2024-08-27 20:42:51 +02:00
|
|
|
ExecStart = "${cfg.package}/bin/ckb-next-daemon ${
|
|
|
|
lib.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
|
|
|
};
|
|
|
|
};
|
2024-12-10 20:26:33 +01:00
|
|
|
};
|
2017-01-12 18:25:14 +00:00
|
|
|
|
|
|
|
meta = {
|
2024-07-28 16:44:11 +02:00
|
|
|
maintainers = [ ];
|
2017-01-12 18:25:14 +00:00
|
|
|
};
|
|
|
|
}
|