2022-02-24 15:15:36 +01: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-13 14:54:15 +02:00
|
|
|
enable = mkEnableOption "K40-Whisperer";
|
2022-02-24 15:15:36 +01:00
|
|
|
|
|
|
|
group = mkOption {
|
|
|
|
type = types.str;
|
2024-04-13 14:54:15 +02:00
|
|
|
description = ''
|
2022-02-24 15:15:36 +01:00
|
|
|
Group assigned to the device when connected.
|
|
|
|
'';
|
|
|
|
default = "k40";
|
|
|
|
};
|
|
|
|
|
2023-11-27 01:19:27 +01:00
|
|
|
package = mkPackageOption pkgs "k40-whisperer" { };
|
2022-02-24 15:15:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
users.groups.${cfg.group} = {};
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkg ];
|
|
|
|
services.udev.packages = [ pkg ];
|
|
|
|
};
|
|
|
|
}
|