stockholm/krebs/2configs/shack/glados/default.nix

157 lines
4.1 KiB
Nix
Raw Normal View History

{ config, pkgs, lib, ... }:
let
shackopen = import ./multi/shackopen.nix;
wasser = import ./multi/wasser.nix;
2020-01-07 15:52:31 +00:00
badair = import ./multi/schlechte_luft.nix;
in {
2019-09-19 19:31:21 +00:00
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;
2019-09-19 19:31:21 +00:00
proxy_buffering off;
'';
};
};
services.home-assistant = let
dwd_pollen = pkgs.fetchFromGitHub {
owner = "marcschumacher";
repo = "dwd_pollen";
rev = "0.1";
sha256 = "1af2mx99gv2hk1ad53g21fwkdfdbymqcdl3jvzd1yg7dgxlkhbj1";
};
in {
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 pkgs.picotts
];
};
autoExtraComponents = true;
config = {
homeassistant = {
name = "Glados";
time_zone = "Europe/Berlin";
latitude = "48.8265";
longitude = "9.0676";
elevation = 303;
auth_providers = [
{ type = "homeassistant";}
{ type = "trusted_networks";
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";
# tags = {
# instance = "wolf";
# source = "hass";
# };
#};
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";
qos = 1;
retain = true;
};
will_message = {
topic = "glados/hass/status/LWT";
payload = "Offline";
qos = 1;
retain = true;
};
};
switch =
wasser.switch
++ (import ./switch/power.nix)
;
light = [];
media_player = [
{ platform = "mpd";
2020-01-23 22:52:39 +00:00
name = "lounge";
host = "lounge.mpd.shack";
}
{ platform = "mpd";
name = "kiosk";
host = "lounge.kiosk.shack";
}
];
sensor =
(import ./sensors/power.nix)
++ (import ./sensors/mate.nix)
++ (import ./sensors/darksky.nix { inherit lib;})
2020-01-08 09:16:21 +00:00
++ shackopen.sensor
;
air_quality = (import ./sensors/sensemap.nix );
binary_sensor =
shackopen.binary_sensor
++ (import ./sensors/spaceapi.nix)
;
camera = [];
frontend = { };
config = { };
http = {
base_url = "http://hass.shack";
use_x_forwarded_for = true;
trusted_proxies = "127.0.0.1";
};
#conversation = {};
# history = {};
2020-06-17 07:09:53 +00:00
#logbook = {};
logger.default = "info";
2020-06-17 07:09:53 +00:00
#recorder = {};
tts = [
{ platform = "google_translate";
2020-01-23 22:52:39 +00:00
service_name = "say";
language = "de";
2020-01-23 22:52:39 +00:00
cache = true;
time_memory = 57600;
}
];
sun = {};
2020-01-23 22:52:39 +00:00
automation = wasser.automation
++ badair.automation
++ (import ./automation/shack-startup.nix)
++ (import ./automation/hass-restart.nix);
device_tracker = [];
};
};
}