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