{ makeSystem , nixpkgs }: makeSystem { system = "x86_64-linux"; name = "nixng-home-assistant"; inherit nixpkgs; config = { pkgs, lib, ... }: 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 ]; ensureSomething.create."media" = { type = "directory"; mode = "755"; owner = "home-assistant"; dst = "/media"; persistent = true; }; }; services.home-assistant = { enable = true; envsubst = true; customComponents = {}; 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"; }; automation = "!include automations.yaml"; "automation static" = [ (import ./configs/automations/alarm/pending.nix) (import ./configs/automations/alarm/disarmed.nix) (import ./configs/automations/alarm/triggered.nix) (import ./configs/automations/alarm/retriggered.nix) (import ./configs/automations/alarm/motion-detected.nix) (import ./configs/automations/alarm/motion-detected-away.nix) (import ./configs/automations/bathroom_light/dim.nix) (import ./configs/automations/bathroom_light/brighten.nix) (import ./configs/automations/bathroom_light/on.nix) (import ./configs/automations/bathroom_light/off.nix) ]; 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" "safe_mode" "met" "zha" "mobile_app" "dhcp" "logbook" "history" "ssdp" "mqtt" "stream" "recorder" ]; extraPackages = ps: with ps; [ xmodem psycopg2 aiohttp-cors bleak-retry-connector psutil-home-assistant bluetooth-auto-recovery ]; }; }; }; }; }