Update flake locking
This commit is contained in:
@@ -7,19 +7,44 @@ in
|
||||
{
|
||||
virtualisation.podman.enable = true;
|
||||
|
||||
services.home-assistant = {
|
||||
enable = true;
|
||||
configDir = "/var/lib/hass";
|
||||
package = (pkgs.home-assistant.override {
|
||||
extraComponents = [
|
||||
"accuweather"
|
||||
"cast"
|
||||
"eufy"
|
||||
"lovelace"
|
||||
"tplink"
|
||||
"wiz"
|
||||
"zwave_js"
|
||||
];
|
||||
}).overrideAttrs (oldAttrs: {
|
||||
doInstallCheck = false;
|
||||
});
|
||||
|
||||
config = {
|
||||
default_config = {};
|
||||
esphome = {}; # Get these things loaded, even if not configured
|
||||
met = {};
|
||||
tts = [ { platform = "google_translate"; } ];
|
||||
http = {
|
||||
use_x_forwarded_for = true;
|
||||
trusted_proxies = [ "127.0.0.1" "::1" ];
|
||||
server_host = "127.0.0.1";
|
||||
};
|
||||
"automation ui" = "!include automations.yaml";
|
||||
"script ui" = "!include scripts.yaml";
|
||||
"scene ui" = "!include scenes.yaml";
|
||||
};
|
||||
};
|
||||
|
||||
# Although NixOS has a package for Home Assistant, it is not kept as up to date as the container and the upstream
|
||||
# is very vocal about only supporting their own container or the HAOS deployments. So we deploy the container here
|
||||
# and avoid any potential messes from that
|
||||
virtualisation.oci-containers = {
|
||||
backend = "podman";
|
||||
containers."home-assistant" = {
|
||||
image = "ghcr.io/home-assistant/home-assistant:stable";
|
||||
ports = [ "127.0.0.1:8123:8123" ];
|
||||
volumes = [ "/var/lib/hass:/config" ];
|
||||
extraOptions = [
|
||||
"--device" "/dev/ttyAMA0"
|
||||
];
|
||||
};
|
||||
|
||||
# I have ZWave devices. The easiest way to connect to them is the zwavejs2mqtt service running, so we spin up
|
||||
# its container and map the ZWave device into it
|
||||
@@ -36,13 +61,6 @@ in
|
||||
# Both of the above container need storage for their configuration and devices, but it is not created correctly by
|
||||
# the container. So we add the creation of /var/lib/{zwave,hass} to the systemd Unit files
|
||||
systemd.services = {
|
||||
"podman-home-assistant" = {
|
||||
serviceConfig = {
|
||||
StateDirectory = "hass";
|
||||
StateDirectoryMode = pkgs.lib.mkForce "0777";
|
||||
};
|
||||
};
|
||||
|
||||
"podman-zwave".serviceConfig = {
|
||||
StateDirectory = "zwave";
|
||||
StateDirectoryMode = pkgs.lib.mkForce "0777";
|
||||
@@ -50,49 +68,6 @@ in
|
||||
};
|
||||
|
||||
|
||||
# Podman 3.4, which is in NixOS 21.11 does not support creating multiple network interfaces during launch. Starting in Podman
|
||||
# 4.0 (NixOS 22.05) that will be possible. For now, adding this sidecar service that executes after every time the Home Assistant
|
||||
# container is started will do the necessary Podman commands to attach the container to the interface for VLAN 66. Once we
|
||||
# upgrade to NixOS 22.05 this service can go away and we can explicitly add two "--network" options to the Home Assistant container
|
||||
systemd.services."home-assistant-network-attach" = {
|
||||
requires = service_list;
|
||||
path = [ pkgs.podman pkgs.coreutils ];
|
||||
script = "sleep 10 && podman network connect podman66 home-assistant";
|
||||
wantedBy = service_list;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
};
|
||||
};
|
||||
|
||||
# This ensures that Podman has a separate network configured to attach to my IOT VLAN so that Home Assistant is able to communicate
|
||||
# with my devices as well as with the rest of the LAN.
|
||||
systemd.services.podman66 = {
|
||||
wantedBy = service_list;
|
||||
before = service_list;
|
||||
path = [ pkgs.podman ];
|
||||
script = "podman network create -d macvlan -o parent=vlan66 --subnet 192.168.66.0/24 --ip-range 192.168.66.192/26 --gateway 192.168.66.1 podman66 || true";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
};
|
||||
};
|
||||
|
||||
# I do not want to have to remember the port number for Home Assistant's UI, so we use Nginx to proxy communication from
|
||||
# smart.thehellings.lan to the Home Assistant UI
|
||||
# After the first activation of this container, before you can access the Home Assistant UI, you need to ensure that the
|
||||
# Home Assistant's configuration at /var/lib/hass/configuration.yaml includes the following option. Update the IP address
|
||||
# if you have changed the value of your default podman network.
|
||||
# ```yaml
|
||||
# http:
|
||||
# use_x_forwarded_for: true
|
||||
# trusted_proxies:
|
||||
# - "10.88.0.1"
|
||||
# ```
|
||||
# Home assistant will not accept connections from the proxy if these values are not set. If you are adding those values
|
||||
# manually after initial creation of the containers, then you will need to issue `systemctl restart podman-home-assistant.service`
|
||||
# for Home Assistant to pick up the new values. After that, proxy connections should work well. If you are sitting behind
|
||||
# multiple layers of proxies, then add more of them in the list. The list also accepts subnet notation in case you have
|
||||
# multiple potentially incoming connections. So you could do "10.88.0.1/24", according to the docs. However, that has not
|
||||
# worked in my testing, as Home Assistant throws an error on start up saying that value is invalid
|
||||
greg.proxies."smart.thehellings.lan".target = "http://127.0.0.1:8123";
|
||||
|
||||
# Ensure that both ports are up and running. We keep 8123 directly open because we are on the LAN and sometimes want to connect
|
||||
@@ -107,12 +82,6 @@ in
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
folders = {
|
||||
"asdf-fdsa" = {
|
||||
enable = true;
|
||||
path = "/var/lib/hass";
|
||||
devices = [ "nas" ];
|
||||
};
|
||||
|
||||
"zwave-live" = {
|
||||
enable = true;
|
||||
path = "/var/lib/zwave";
|
||||
|
||||
Reference in New Issue
Block a user