52 lines
1.2 KiB
Nix
52 lines
1.2 KiB
Nix
{
|
|
inputs,
|
|
config,
|
|
namespace,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib.${namespace}) mkOpt;
|
|
name = "otbr";
|
|
cfg = config.${namespace}.services.${name};
|
|
|
|
otbrPackage =
|
|
pkgs.callPackage "${inputs.nixpkgs-otbr}/pkgs/by-name/op/openthread-border-router/package.nix"
|
|
{ };
|
|
|
|
otbrConfig = lib.${namespace}.mkModule {
|
|
inherit config name;
|
|
description = "Openthread border router";
|
|
options = {
|
|
restPort = mkOpt lib.types.int 8081 "";
|
|
};
|
|
moduleConfig = {
|
|
services.openthread-border-router = {
|
|
enable = true;
|
|
backboneInterface = "enp2s0";
|
|
package = otbrPackage;
|
|
rest = {
|
|
inherit (cfg) listenAddress;
|
|
listenPort = cfg.restPort;
|
|
};
|
|
web = {
|
|
inherit (cfg) listenAddress;
|
|
listenPort = cfg.port;
|
|
};
|
|
radio = {
|
|
device = "/dev/serial/by-id/usb-dresden_elektronik_Thread_RCP__ConBee_II__DE2475318-if00";
|
|
baudRate = 460800;
|
|
flowControl = true;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
in
|
|
{
|
|
imports = [
|
|
"${inputs.nixpkgs-otbr}/nixos/modules/services/home-automation/openthread-border-router.nix"
|
|
otbrConfig
|
|
];
|
|
}
|