diff --git a/flake.lock b/flake.lock index a10a24c..2fab2d7 100644 --- a/flake.lock +++ b/flake.lock @@ -732,6 +732,22 @@ "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": { "locked": { "lastModified": 1772598333, @@ -859,6 +875,7 @@ "nix-minecraft": "nix-minecraft", "nixgl": "nixgl", "nixpkgs": "nixpkgs_3", + "nixpkgs-otbr": "nixpkgs-otbr", "nixvim": "nixvim", "noctalia": "noctalia", "starship-jj": "starship-jj", diff --git a/flake.nix b/flake.nix index bdc101e..2cc5b3e 100644 --- a/flake.nix +++ b/flake.nix @@ -76,6 +76,9 @@ url = "gitlab:lanastara_foss/starship-jj"; inputs.nixpkgs.follows = "nixpkgs"; }; + nixpkgs-otbr = { + url = "github:mrene/nixpkgs/openthread-border-router"; + }; }; outputs = diff --git a/hosts/watt/configuration.nix b/hosts/watt/configuration.nix index 9edc1cf..d55cc09 100644 --- a/hosts/watt/configuration.nix +++ b/hosts/watt/configuration.nix @@ -15,6 +15,7 @@ ../../modules/system/gc.nix ../../modules/system/nixvim.nix ../../modules/system/tailscale.nix + ../../modules/system/home-assistant.nix inputs.disko.nixosModules.disko inputs.nixvim.nixosModules.nixvim ]; diff --git a/modules/system/home-assistant.nix b/modules/system/home-assistant.nix new file mode 100644 index 0000000..c9e1d06 --- /dev/null +++ b/modules/system/home-assistant.nix @@ -0,0 +1,48 @@ +{ config, pkgs, inputs, ... }: +{ + imports = [ + (inputs.nixpkgs-otbr + "/nixos/modules/services/home-automation/openthread-border-router.nix") + ]; + + services.openthread-border-router = { + enable = true; + package = (import inputs.nixpkgs-otbr { system = pkgs.system; }).openthread-border-router; + backboneInterface = "enp7s0u2c2"; + radio = { + device = "/dev/serial/by-id/usb-Nabu_Casa_ZBT-2_9C139EAAD5E8-if00"; + baudRate = 460800; + flowControl = true; + }; + }; + + services.matter-server.enable = true; + + services.home-assistant = { + enable = true; + extraComponents = [ + # Required for onboarding + "esphome" + "matter" + "met" + "otbr" + "thread" + "radio_browser" + ]; + config = { + homeassistant = { + name = "Home"; + unit_system = "metric"; + time_zone = config.time.timeZone; + }; + default_config = { }; + http = { + server_port = 8123; + use_x_forwarded_for = true; + trusted_proxies = [ + "127.0.0.1" + "::1" + ]; + }; + }; + }; +}