From 9e9f24321845367b94136c720db2a1398ba145f4 Mon Sep 17 00:00:00 2001 From: magic_rb Date: Tue, 9 Jan 2024 14:56:53 +0100 Subject: [PATCH] Add `watchdog` and `reolink_aio` to list of Hass python modules Signed-off-by: magic_rb --- .../home-assistant/home-assistant.nix | 227 +++++++++--------- 1 file changed, 120 insertions(+), 107 deletions(-) diff --git a/nixng/containers/home-assistant/home-assistant.nix b/nixng/containers/home-assistant/home-assistant.nix index eab8de0..0c377b7 100644 --- a/nixng/containers/home-assistant/home-assistant.nix +++ b/nixng/containers/home-assistant/home-assistant.nix @@ -1,122 +1,133 @@ -{ makeSystem -, nixpkgs +{ + makeSystem, + nixpkgs, }: makeSystem { system = "x86_64-linux"; name = "nixng-home-assistant"; inherit nixpkgs; - config = - { pkgs, lib, nglib, ... }: - let - inherit (lib) - singleton; - in - { - config = { - dumb-init = { - enable = true; - type.services = {}; - }; + config = { + pkgs, + lib, + nglib, + ... + }: let + inherit + (lib) + singleton + ; + in { + config = { + dumb-init = { + enable = true; + type.services = {}; + }; - init.services.home-assistant = { - shutdownOnExit = true; - environment.PATH = with pkgs; pkgs.lib.makeBinPath [ - coreutils git ffmpeg bash runit + init.services.home-assistant = { + shutdownOnExit = true; + environment.PATH = with pkgs; + pkgs.lib.makeBinPath [ + coreutils + git + ffmpeg + bash + runit ]; - ensureSomething.create."media" = { - type = "directory"; - mode = "755"; - owner = "home-assistant"; - dst = "/media"; - persistent = true; + ensureSomething.create."media" = { + type = "directory"; + mode = "755"; + owner = "home-assistant"; + dst = "/media"; + persistent = true; + }; + }; + + services.home-assistant = { + enable = true; + envsubst = true; + customComponents = { + pyscript = pkgs.fetchzip { + url = "https://github.com/custom-components/pyscript/releases/download/1.5.0/hass-custom-pyscript.zip"; + hash = "sha256-d+WBqdCw/J3a+hrQD5dxVZdmgsMcxbukDxWFDnKdI0o="; + stripRoot = false; }; }; - - services.home-assistant = { - enable = true; - envsubst = true; - customComponents = { - pyscript = pkgs.fetchzip { - url = "https://github.com/custom-components/pyscript/releases/download/1.5.0/hass-custom-pyscript.zip"; - hash = "sha256-d+WBqdCw/J3a+hrQD5dxVZdmgsMcxbukDxWFDnKdI0o="; - stripRoot = false; - }; + config = { + default_config = {}; + recorder = { + db_url = "postgresql://hass:\${PSQL_PASSWORD}@127.0.0.1/hass?client_encoding=utf8"; + db_max_retries = 5; + db_retry_wait = 30; }; - config = { - default_config = {}; - recorder = { - db_url = "postgresql://hass:\${PSQL_PASSWORD}@127.0.0.1/hass?client_encoding=utf8"; - db_max_retries = 5; - db_retry_wait = 30; - }; - stream = {}; - http = { - server_port = "8123"; - use_x_forwarded_for = true; - trusted_proxies = [ "127.0.0.1" ]; - }; - logger.default = "info"; - homeassistant = - { name = "Home"; - latitude = "\${LATITUDE}"; - longitude = "\${LONGTITUDE}"; - elevation = "\${ELEVATION}"; - # currency = "EUR"; - unit_system = "metric"; - time_zone = "\${TIME_ZONE}"; - country = "\${COUNTRY}"; - internal_url = "http://localhost:8123/"; - whitelist_external_dirs = [ - "/mnt/cctv" - ]; - media_dirs.local = "/mnt/cctv"; - }; - - pyscript = { - allow_all_imports = false; - hass_is_global = true; - }; - - automation = "!include automations.yaml"; - alarm_control_panel = import ./configs/alarm_control_panel.nix; - frontend.themes = {}; - sensor = singleton { - platform = "time_date"; - display_options = [ - "time" - "date" - "date_time" - "date_time_utc" - "date_time_iso" - "time_date" - "time_utc" - "beat" - ]; - }; + stream = {}; + http = { + server_port = "8123"; + use_x_forwarded_for = true; + trusted_proxies = ["127.0.0.1"]; }; - package = pkgs.home-assistant.override { - extraComponents = [ - "http" - "homeassistant" - # "image" - "person" - "cloud" - "camera" - "onboarding" - "frontend" - "met" - "zha" - "mobile_app" - "dhcp" - "logbook" - "history" - "ssdp" - "mqtt" - "stream" - "recorder" + logger.default = "info"; + homeassistant = { + name = "Home"; + latitude = "\${LATITUDE}"; + longitude = "\${LONGTITUDE}"; + elevation = "\${ELEVATION}"; + # currency = "EUR"; + unit_system = "metric"; + time_zone = "\${TIME_ZONE}"; + country = "\${COUNTRY}"; + internal_url = "http://localhost:8123/"; + whitelist_external_dirs = [ + "/mnt/cctv" ]; + media_dirs.local = "/mnt/cctv"; + }; - extraPackages = ps: with ps; [ + pyscript = { + allow_all_imports = false; + hass_is_global = true; + }; + + automation = "!include automations.yaml"; + alarm_control_panel = import ./configs/alarm_control_panel.nix; + frontend.themes = {}; + sensor = singleton { + platform = "time_date"; + display_options = [ + "time" + "date" + "date_time" + "date_time_utc" + "date_time_iso" + "time_date" + "time_utc" + "beat" + ]; + }; + }; + package = pkgs.home-assistant.override { + extraComponents = [ + "http" + "homeassistant" + # "image" + "person" + "cloud" + "camera" + "onboarding" + "frontend" + "met" + "zha" + "mobile_app" + "dhcp" + "logbook" + "history" + "ssdp" + "mqtt" + "stream" + "recorder" + ]; + + extraPackages = ps: + with ps; [ xmodem psycopg2 aiohttp-cors @@ -124,9 +135,11 @@ makeSystem { psutil-home-assistant bluetooth-auto-recovery croniter + reolink-aio + watchdog ]; - }; }; }; }; + }; }