-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
436 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ 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 { | ||
|
||
# TODO: Rename to .conf in upcomming release | ||
environment.etc."usbrelayd.ini".text = '' | ||
[MQTT] | ||
BROKER = ${cfg.broker} | ||
CLIENTNAME = ${cfg.clientName} | ||
''; | ||
|
||
services.udev.packages = [ pkgs.usbrelayd ]; | ||
systemd.packages = [ pkgs.usbrelayd ]; | ||
users.users.usbrelay = { | ||
isSystemUser = true; | ||
group = "usbrelay"; | ||
}; | ||
users.groups.usbrelay = { }; | ||
}; | ||
} |
Oops, something went wrong.