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