make companion a ha hub

This commit is contained in:
Hendrik Sokolowski 2023-04-01 16:48:12 +02:00
parent 963fc644b1
commit a6376572c1
3 changed files with 104 additions and 23 deletions

View file

@ -12,6 +12,7 @@
imports = [
./hardware-configuration.nix
./home-controller.nix
./home-assistant.nix
];
boot.loader.timeout = lib.mkForce 0;
@ -42,7 +43,7 @@
boot.loader.systemd-boot.enable = lib.mkForce false;
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [2380 6443];
networking.firewall.allowedTCPPorts = [2380 6443 8080 8123];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;

View file

@ -1,22 +1,26 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" "uas" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.initrd.availableKernelModules = ["xhci_pci" "usbhid" "usb_storage" "uas"];
boot.initrd.kernelModules = [];
boot.kernelModules = [];
boot.extraModulePackages = [];
boot.kernelParams = [ "usb-storage.quirks=2109:0716:u,174c:55aa:u" ];
#boot.kernelParams = [ "usb-storage.quirks=2109:0716:u,174c:55aa:u" ];
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.supportedFilesystems = [ ];
boot.supportedFilesystems = [];
boot.loader.grub = {
enable = true;
@ -38,19 +42,19 @@
bypassWorkqueues = true;
};
fileSystems."/" =
{ device = "/dev/disk/by-label/root";
fsType = "ext4";
};
fileSystems."/" = {
device = "/dev/disk/by-label/root";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/5552-1B21";
fsType = "vfat";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/5552-1B21";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-label/swap"; }
];
swapDevices = [
{device = "/dev/disk/by-label/swap";}
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's

View file

@ -0,0 +1,76 @@
{
self,
config,
pkgs,
...
}: {
config = {
services.mosquitto = {
enable = true;
listeners = [
{
users = {
z2m.hashedPassword = "$7$101$iZE7WOCQIaLtuoVN$M7AAB/mMmhkuXQVmu2RPoJzm744bmwxGTJwE0eoqlPAjyQHbjmOWfEuKoo9jnQCoQu2T96gS8znsUNizGgPWiQ==";
ha.hashedPassword = "$7$101$jLA9PReG5btNSvw8$O0c3UzCfcBcvqVH8kMZIwEims7p1L4o/DmOTHO9w9731ggC5SyUpJGQIDiUbv+IrTl/H0+Fz9QF/jvY0QCuxuA==";
};
}
];
};
services.udev.extraRules = ''KERNEL=="ttyS0", OWNER="zigbee2mqtt", GROUP="zigbee2mqtt"'';
services.zigbee2mqtt = {
enable = true;
settings = {
frontend = true;
permit_join = true;
homeassistant = true;
options = "-d -d";
mqtt = {
user = "z2m";
password = "!secrets.yaml mqtt_password";
};
serial = {
port = "/dev/ttyS0";
adapter = "deconz";
};
#advanced.network_key = "'!secrets.yaml network_key'";
};
};
#users.users.hass.extraGroups = [ "tty" ];
services.home-assistant = {
enable = true;
extraComponents = ["fritz" "fritzbox" "fritzbox_callmonitor" "met" "mqtt"];
config = {
homeassistant = {};
http = {
ip_ban_enabled = false;
use_x_forwarded_for = true;
trusted_proxies = [
"127.0.0.1"
"10.254.0.21"
"10.0.1.5"
"10.0.1.6"
"172.16.0.0/12"
];
};
energy = {};
frontend = {};
history = {};
map = {};
my = {};
mobile_app = {};
network = {};
notify = {};
person = {};
ssdp = {};
sun = {};
system_health = {};
zeroconf = {};
};
};
};
}