Skip to content

Commit

Permalink
Merge staging-next into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Apr 25, 2022
2 parents 0b47e64 + b258091 commit 2855667
Show file tree
Hide file tree
Showing 18 changed files with 436 additions and 128 deletions.
1 change: 1 addition & 0 deletions lib/systems/inspect.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ rec {
isx86_64 = { cpu = { family = "x86"; bits = 64; }; };
isPowerPC = { cpu = cpuTypes.powerpc; };
isPower = { cpu = { family = "power"; }; };
isPower64 = { cpu = { family = "power"; bits = 64; }; };
isx86 = { cpu = { family = "x86"; }; };
isAarch32 = { cpu = { family = "arm"; bits = 32; }; };
isAarch64 = { cpu = { family = "arm"; bits = 64; }; };
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@
./services/hardware/udisks2.nix
./services/hardware/upower.nix
./services/hardware/usbmuxd.nix
./services/hardware/usbrelayd.nix
./services/hardware/thermald.nix
./services/hardware/undervolt.nix
./services/hardware/vdr.nix
Expand Down
44 changes: 44 additions & 0 deletions nixos/modules/services/hardware/usbrelayd.nix
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 = { };
};
}
Loading

0 comments on commit 2855667

Please sign in to comment.