make companion a ha hub
This commit is contained in:
parent
963fc644b1
commit
a6376572c1
|
@ -12,6 +12,7 @@
|
||||||
imports = [
|
imports = [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./home-controller.nix
|
./home-controller.nix
|
||||||
|
./home-assistant.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.loader.timeout = lib.mkForce 0;
|
boot.loader.timeout = lib.mkForce 0;
|
||||||
|
@ -42,7 +43,7 @@
|
||||||
boot.loader.systemd-boot.enable = lib.mkForce false;
|
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||||
|
|
||||||
# Open ports in the firewall.
|
# Open ports in the firewall.
|
||||||
networking.firewall.allowedTCPPorts = [2380 6443];
|
networking.firewall.allowedTCPPorts = [2380 6443 8080 8123];
|
||||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||||
# Or disable the firewall altogether.
|
# Or disable the firewall altogether.
|
||||||
# networking.firewall.enable = false;
|
# networking.firewall.enable = false;
|
||||||
|
|
|
@ -1,22 +1,26 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
imports =
|
config,
|
||||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
lib,
|
||||||
];
|
pkgs,
|
||||||
|
modulesPath,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
imports = [
|
||||||
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" "uas" ];
|
boot.initrd.availableKernelModules = ["xhci_pci" "usbhid" "usb_storage" "uas"];
|
||||||
boot.initrd.kernelModules = [ ];
|
boot.initrd.kernelModules = [];
|
||||||
boot.kernelModules = [ ];
|
boot.kernelModules = [];
|
||||||
boot.extraModulePackages = [ ];
|
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.kernelPackages = pkgs.linuxPackages_latest;
|
||||||
boot.supportedFilesystems = [ ];
|
boot.supportedFilesystems = [];
|
||||||
|
|
||||||
boot.loader.grub = {
|
boot.loader.grub = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -38,19 +42,19 @@
|
||||||
bypassWorkqueues = true;
|
bypassWorkqueues = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/" =
|
fileSystems."/" = {
|
||||||
{ device = "/dev/disk/by-label/root";
|
device = "/dev/disk/by-label/root";
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/boot" =
|
fileSystems."/boot" = {
|
||||||
{ device = "/dev/disk/by-uuid/5552-1B21";
|
device = "/dev/disk/by-uuid/5552-1B21";
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices =
|
swapDevices = [
|
||||||
[ { device = "/dev/disk/by-label/swap"; }
|
{device = "/dev/disk/by-label/swap";}
|
||||||
];
|
];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# 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
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|
76
hosts/companion/home-assistant.nix
Normal file
76
hosts/companion/home-assistant.nix
Normal 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 = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue