at 23.11-beta 1.4 kB view raw
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 (lib.mdDoc "the Corsair keyboard/mouse driver"); 17 18 gid = mkOption { 19 type = types.nullOr types.int; 20 default = null; 21 example = 100; 22 description = lib.mdDoc '' 23 Limit access to the ckb daemon to a particular group. 24 ''; 25 }; 26 27 package = mkOption { 28 type = types.package; 29 default = pkgs.ckb-next; 30 defaultText = literalExpression "pkgs.ckb-next"; 31 description = lib.mdDoc '' 32 The package implementing the Corsair keyboard/mouse driver. 33 ''; 34 }; 35 }; 36 37 config = mkIf cfg.enable { 38 environment.systemPackages = [ cfg.package ]; 39 40 systemd.services.ckb-next = { 41 description = "Corsair Keyboards and Mice Daemon"; 42 wantedBy = ["multi-user.target"]; 43 serviceConfig = { 44 ExecStart = "${cfg.package}/bin/ckb-next-daemon ${optionalString (cfg.gid != null) "--gid=${builtins.toString cfg.gid}"}"; 45 Restart = "on-failure"; 46 }; 47 }; 48 }; 49 50 meta = { 51 maintainers = with lib.maintainers; [ ]; 52 }; 53 }