diff options
Diffstat (limited to 'krebs/2configs/shack/glados/default.nix')
-rw-r--r-- | krebs/2configs/shack/glados/default.nix | 147 |
1 files changed, 79 insertions, 68 deletions
diff --git a/krebs/2configs/shack/glados/default.nix b/krebs/2configs/shack/glados/default.nix index 54e7aef5..53d6e6f4 100644 --- a/krebs/2configs/shack/glados/default.nix +++ b/krebs/2configs/shack/glados/default.nix @@ -1,75 +1,96 @@ { config, pkgs, lib, ... }: let - shackopen = import ./multi/shackopen.nix; - wasser = import ./multi/wasser.nix; + unstable = import (pkgs.fetchFromGitHub { + owner = "nixos"; + repo = "nixpkgs"; + rev = (lib.importJSON ../../../nixpkgs-unstable.json).rev; + sha256 = (lib.importJSON ../../../nixpkgs-unstable.json).sha256; + }) {}; in { - services.nginx.virtualHosts."hass.shack".locations."/" = { - proxyPass = "http://localhost:8123"; - extraConfig = '' - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; + services.nginx.virtualHosts."hass.shack" = { + serverAliases = [ "glados.shack" ]; + locations."/" = { + proxyPass = "http://localhost:8123"; + extraConfig = '' + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; - proxy_buffering off; - ''; + proxy_buffering off; + ''; + }; }; - services.home-assistant = let - dwd_pollen = pkgs.fetchFromGitHub { - owner = "marcschumacher"; - repo = "dwd_pollen"; - rev = "0.1"; - sha256 = "1af2mx99gv2hk1ad53g21fwkdfdbymqcdl3jvzd1yg7dgxlkhbj1"; - }; - in { + imports = [ + ./multi/shackopen.nix + ./multi/wasser.nix + ./multi/schlechte_luft.nix + ./multi/rollos.nix + + ./switch/power.nix + + ./sensors/power.nix + ./sensors/mate.nix + ./sensors/darksky.nix + ./sensors/spaceapi.nix + ./sensors/sensemap.nix + + ./automation/shack-startup.nix + ./automation/party-time.nix + ./automation/hass-restart.nix + + ]; + services.home-assistant = + { enable = true; - package = (pkgs.home-assistant.overrideAttrs (old: { - # TODO: find correct python package - installCheckPhase = '' - echo LOLLLLLLLLLLLLLL - ''; - postInstall = '' - cp -r ${dwd_pollen} $out/lib/python3.7/site-packages/homeassistant/components/dwd_pollen - ''; - })).override { - extraPackages = ps: with ps; [ - python-forecastio jsonrpc-async jsonrpc-websocket mpd2 - (callPackage ./deps/gtts-token.nix { }) - (callPackage ./deps/pyhaversion.nix { }) - ]; - }; autoExtraComponents = true; + package = unstable.home-assistant.overrideAttrs (old: { + doInstallCheck = false; + }); config = { homeassistant = { - name = "Bureautomation"; + name = "Glados"; time_zone = "Europe/Berlin"; latitude = "48.8265"; longitude = "9.0676"; elevation = 303; auth_providers = [ { type = "homeassistant";} - { type = "legacy_api_password";} { type = "trusted_networks"; - # allow_bypass_login = true; + trusted_networks = [ + "127.0.0.1/32" + "10.42.0.0/16" + "::1/128" + "fd00::/8" + ]; } ]; }; # https://www.home-assistant.io/components/influxdb/ influxdb = { - database = "hass"; + database = "glados"; + host = "influx.shack"; + component_config_glob = { + "sensor.*particulate_matter_2_5um_concentration".override_measurement = "2_5um particles"; + "sensor.*particulate_matter_10_0um_concentration".override_measurement ="10um particles"; + }; tags = { instance = "wolf"; - source = "hass"; + source = "glados"; }; }; + esphome = {}; + api = {}; mqtt = { broker = "localhost"; port = 1883; client_id = "home-assistant"; keepalive = 60; protocol = 3.1; + discovery = true; #enable esphome discovery + discovery_prefix = "homeassistant"; birth_message = { topic = "glados/hass/status/LWT"; payload = "Online"; @@ -83,53 +104,43 @@ in { retain = true; }; }; - switch = wasser.switch; light = []; media_player = [ { platform = "mpd"; + name = "lounge"; host = "lounge.mpd.shack"; } + { platform = "mpd"; + name = "kiosk"; + host = "lounge.kiosk.shack"; + } ]; - sensor = - [{ platform = "version"; }] - ++ (import ./sensors/hass.nix) - ++ (import ./sensors/power.nix) - ++ shackopen.sensor; - - binary_sensor = shackopen.binary_sensor; - camera = []; - frontend = { }; + config = { }; + sun = {}; http = { - # TODO: https://github.com/home-assistant/home-assistant/issues/16149 base_url = "http://hass.shack"; use_x_forwarded_for = true; trusted_proxies = "127.0.0.1"; - api_password = "shackit"; - trusted_networks = [ - "127.0.0.1/32" - "10.42.0.0/16" - "::1/128" - "fd00::/8" - ]; }; - conversation = {}; + #conversation = {}; + history = {}; logbook = {}; + #recorder = {}; + + logger.default = "info"; + tts = [ - { platform = "google"; + { platform = "google_translate"; + service_name = "say"; language = "de"; - } - { platform = "picotts"; - language = "de-DE"; + cache = true; + time_memory = 57600; } ]; - recorder = {}; - sun = {}; - - automation = wasser.automation; device_tracker = []; }; }; |