2022-03-05 16:20:37 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.k40-whisperer;
|
|
|
|
pkg = cfg.package.override {
|
|
|
|
udevGroup = cfg.group;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.programs.k40-whisperer = {
|
2024-04-21 15:54:59 +00:00
|
|
|
enable = mkEnableOption "K40-Whisperer";
|
2022-03-05 16:20:37 +00:00
|
|
|
|
|
|
|
group = mkOption {
|
|
|
|
type = 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-01-02 11:29:13 +00:00
|
|
|
package = mkPackageOption pkgs "k40-whisperer" { };
|
2022-03-05 16:20:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
users.groups.${cfg.group} = {};
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkg ];
|
|
|
|
services.udev.packages = [ pkg ];
|
|
|
|
};
|
|
|
|
}
|