nixpkgs/nixos/modules/services/hardware/usbrelayd.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
902 B
Nix
Raw Normal View History

2022-03-29 21:54:42 +00:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.usbrelayd;
in
{
options.services.usbrelayd = with types; {
enable = mkEnableOption "USB Relay MQTT daemon";
broker = mkOption {
type = str;
description = "Hostname or IP address of your MQTT Broker.";
default = "127.0.0.1";
example = [
"mqtt"
"192.168.1.1"
];
};
clientName = mkOption {
type = str;
description = "Name, your client connects as.";
default = "MyUSBRelay";
};
};
config = mkIf cfg.enable {
2022-05-08 19:16:32 +00:00
environment.etc."usbrelayd.conf".text = ''
2022-03-29 21:54:42 +00:00
[MQTT]
BROKER = ${cfg.broker}
CLIENTNAME = ${cfg.clientName}
'';
services.udev.packages = [ pkgs.usbrelayd ];
systemd.packages = [ pkgs.usbrelayd ];
users.groups.usbrelay = { };
};
meta = {
maintainers = with lib.maintainers; [ wentasah ];
};
2022-03-29 21:54:42 +00:00
}