This commit is contained in:
mjallen18
2026-01-12 15:13:02 -06:00
parent 42e771ef1f
commit 639ce36cb0
3 changed files with 50 additions and 20 deletions

17
flake.lock generated
View File

@@ -1086,6 +1086,22 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-otbr": {
"locked": {
"lastModified": 1766776257,
"narHash": "sha256-MG9DnzBn6TdAztaMPVhW9sjYj2bi9Jcux0F0fJ6LeO4=",
"owner": "mrene",
"repo": "nixpkgs",
"rev": "0c4c97066d555b7d27a0a56ee400130ec51f02ee",
"type": "github"
},
"original": {
"owner": "mrene",
"ref": "openthread-border-router",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1751048012, "lastModified": 1751048012,
@@ -1472,6 +1488,7 @@
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixos-raspberrypi": "nixos-raspberrypi", "nixos-raspberrypi": "nixos-raspberrypi",
"nixpkgs": "nixpkgs_12", "nixpkgs": "nixpkgs_12",
"nixpkgs-otbr": "nixpkgs-otbr",
"nixpkgs-stable": "nixpkgs-stable_2", "nixpkgs-stable": "nixpkgs-stable_2",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"pre-commit-hooks-nix": "pre-commit-hooks-nix", "pre-commit-hooks-nix": "pre-commit-hooks-nix",

View File

@@ -1,19 +1,25 @@
{ config, lib, ... }: { inputs, config, namespace, lib, pkgs, ... }:
let let
inherit (lib.${namespace}) mkModule mkOpt mkBoolOpt;
name = "otbr"; name = "otbr";
cfg = config.${namespace}.services.${name}; cfg = config.${namespace}.services.${name};
otbrPackage = pkgs.callPackage "${inputs.nixpkgs-otbr}/pkgs/by-name/op/openthread-border-router/package.nix" { };
otbrConfig = lib.${namespace}.mkModule { otbrConfig = lib.${namespace}.mkModule {
inherit config name; inherit config name;
description = "Openthread border router"; description = "Openthread border router";
options = { }; options = {
restPort = mkOpt lib.types.int 8081 "";
};
moduleConfig = { moduleConfig = {
services.openthread-border-router = { services.openthread-border-router = {
enable = true; enable = true;
backboneInterface = "enp2s0"; backboneInterface = "enp2s0";
package = otbrPackage;
rest = { rest = {
listenAddress = cfg.listenAddress; listenAddress = cfg.listenAddress;
listenPort = cfg.port; listenPort = cfg.restPort;
}; };
web = { web = {
listenAddress = cfg.listenAddress; listenAddress = cfg.listenAddress;

View File

@@ -53,8 +53,8 @@
firewall = { firewall = {
enable = true; enable = true;
allowPing = true; allowPing = true;
allowedTCPPorts = [ 8192 ]; allowedTCPPorts = [ 8192 8080 8081 ];
allowedUDPPorts = [ 8192 ]; allowedUDPPorts = [ 8192 8080 8081 ];
}; };
}; };
@@ -68,24 +68,31 @@
# # Services # # # # Services # #
# ################################################### # ###################################################
services.home-assistant = { services = {
enable = true; home-assistant = {
automation = { enable = true;
lightswitch = { automation = {
living-room-lights = { lightswitch = {
id = 1741726347213; living-room-lights = {
alias = "Living Room Light Switch"; id = 1741726347213;
mqttDeviceId = "958ff6b3c9df0db21e418aaf6410b996"; alias = "Living Room Light Switch";
lightEntityId = "light.living_room_lights"; mqttDeviceId = "958ff6b3c9df0db21e418aaf6410b996";
}; lightEntityId = "light.living_room_lights";
bedroom-lights = { };
id = 1741726231261; bedroom-lights = {
alias = "Bedroom Light Switch"; id = 1741726231261;
mqttDeviceId = "de0f34498214842dcccaa6b08967d6b5"; alias = "Bedroom Light Switch";
lightEntityId = "light.bedroom_lights"; mqttDeviceId = "de0f34498214842dcccaa6b08967d6b5";
lightEntityId = "light.bedroom_lights";
};
}; };
}; };
}; };
otbr = {
enable = true;
restPort = 8081;
port = 8080;
};
}; };
# ################################################### # ###################################################