2022-02-24 14:15:36 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.k40-whisperer;
|
|
|
|
pkg = cfg.package.override {
|
|
|
|
udevGroup = cfg.group;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.programs.k40-whisperer = {
|
2024-04-17 11:37:58 +00:00
|
|
|
enable = lib.mkEnableOption "K40-Whisperer";
|
2022-02-24 14:15:36 +00:00
|
|
|
|
2024-04-17 11:37:58 +00:00
|
|
|
group = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
2022-02-24 14:15:36 +00:00
|
|
|
description = ''
|
|
|
|
Group assigned to the device when connected.
|
|
|
|
'';
|
|
|
|
default = "k40";
|
|
|
|
};
|
|
|
|
|
2024-04-17 11:37:58 +00:00
|
|
|
package = lib.mkPackageOption pkgs "k40-whisperer" { };
|
2022-02-24 14:15:36 +00:00
|
|
|
};
|
|
|
|
|
2024-04-17 11:37:58 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
2022-02-24 14:15:36 +00:00
|
|
|
users.groups.${cfg.group} = { };
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkg ];
|
|
|
|
services.udev.packages = [ pkg ];
|
|
|
|
};
|
|
|
|
}
|