2023-11-11 04:25:36 +01:00
|
|
|
{ config, pkgs, ... }:
|
2023-04-07 01:42:21 +02:00
|
|
|
|
2023-04-08 22:15:10 +02:00
|
|
|
let
|
|
|
|
c3d2MacAddress = "00:0b:ad:00:1d:ea";
|
|
|
|
in
|
2023-04-07 01:42:21 +02:00
|
|
|
{
|
|
|
|
c3d2.deployment.server = "server10";
|
|
|
|
microvm = {
|
|
|
|
mem = 1 * 1024;
|
|
|
|
vcpu = 2;
|
2023-04-08 22:15:10 +02:00
|
|
|
# add a network interface in c3d2 for mDNS
|
2023-04-12 01:23:00 +02:00
|
|
|
interfaces = [{
|
2023-04-08 22:15:10 +02:00
|
|
|
type = "tap";
|
|
|
|
id = builtins.substring 0 15 "c3d2-${config.networking.hostName}";
|
|
|
|
mac = c3d2MacAddress;
|
2023-04-12 01:23:00 +02:00
|
|
|
}];
|
2023-04-07 01:42:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
networking.hostName = "home-assistant";
|
2023-04-08 22:15:10 +02:00
|
|
|
systemd.network = {
|
|
|
|
links."40-c3d2" = {
|
|
|
|
matchConfig.MACAddress = c3d2MacAddress;
|
|
|
|
# rename interface to net name
|
|
|
|
linkConfig.Name = "c3d2";
|
|
|
|
};
|
|
|
|
networks."40-c3d2" = {
|
|
|
|
matchConfig.MACAddress = c3d2MacAddress;
|
|
|
|
networkConfig = {
|
|
|
|
LinkLocalAddressing = "yes";
|
|
|
|
IPv6AcceptRA = "no";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-04-07 01:42:21 +02:00
|
|
|
|
|
|
|
services = {
|
2023-04-08 22:09:38 +02:00
|
|
|
avahi.enable = true;
|
|
|
|
|
2023-11-11 05:01:55 +01:00
|
|
|
backup = {
|
|
|
|
enable = true;
|
|
|
|
paths = [ "/var/lib/hass/" ];
|
|
|
|
};
|
|
|
|
|
2023-04-07 01:42:21 +02:00
|
|
|
home-assistant = {
|
|
|
|
enable = true;
|
|
|
|
config = {
|
2023-04-12 01:23:09 +02:00
|
|
|
binary_sensor = [
|
|
|
|
{
|
|
|
|
platform = "rest";
|
|
|
|
name = "Turmlabor";
|
|
|
|
unique_id = "status_turmlabor_dresden";
|
|
|
|
resource = "https://turmlabor.de/spaces.api";
|
|
|
|
method = "GET";
|
|
|
|
scan_interval = 60;
|
|
|
|
verify_ssl = true;
|
|
|
|
value_template = "{{ value_json['state']['open'] }}";
|
|
|
|
device_class = "door";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
platform = "rest";
|
|
|
|
name = "c3d2";
|
|
|
|
unique_id = "status_c3d2";
|
|
|
|
resource = "https://c3d2.de/spaceapi.json";
|
|
|
|
method = "GET";
|
|
|
|
scan_interval = 60;
|
|
|
|
verify_ssl = true;
|
|
|
|
value_template = "{{ value_json['state']['open'] }}";
|
|
|
|
device_class = "door";
|
|
|
|
}
|
|
|
|
];
|
2023-04-07 01:42:21 +02:00
|
|
|
homeassistant = {
|
2023-10-21 18:35:03 +02:00
|
|
|
external_url = "https://home-assistant.hq.c3d2.de";
|
2023-04-07 01:42:21 +02:00
|
|
|
latitude = "51.08105";
|
|
|
|
longitude = "13.72867";
|
|
|
|
name = "C3D2";
|
|
|
|
};
|
|
|
|
http = rec {
|
|
|
|
# TODO: turn on when the public-access-proxy is using PROXY PROTOCOL
|
|
|
|
# ip_ban_enabled = true;
|
|
|
|
# login_attempts_threshold = 5;
|
|
|
|
server_host = [
|
|
|
|
"127.0.0.1"
|
|
|
|
"::1"
|
|
|
|
];
|
|
|
|
trusted_proxies = server_host;
|
|
|
|
use_x_forwarded_for = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
extraComponents = [
|
2023-12-09 22:45:00 +01:00
|
|
|
"esphome"
|
2024-01-20 00:21:54 +01:00
|
|
|
"met" # Meteorologisk institutt aka the weather widget
|
2023-12-11 23:53:55 +01:00
|
|
|
"mqtt"
|
2023-12-09 22:45:00 +01:00
|
|
|
"radio_browser"
|
2023-04-07 01:42:21 +02:00
|
|
|
"wled"
|
2024-01-20 00:21:54 +01:00
|
|
|
"zha" # Zigbee
|
2023-04-07 01:42:21 +02:00
|
|
|
];
|
2023-10-18 23:35:20 +02:00
|
|
|
ldap.enable = true;
|
2024-01-20 16:22:29 +01:00
|
|
|
package = (pkgs.home-assistant.override {
|
2023-04-08 21:08:25 +02:00
|
|
|
# those tests take a long(er) time and can't be sped up with pytest-xdist
|
2023-10-18 23:35:20 +02:00
|
|
|
packageOverrides = _: prev: let
|
|
|
|
noTests.doCheck = false;
|
2023-04-08 21:08:25 +02:00
|
|
|
in {
|
2023-10-18 23:35:20 +02:00
|
|
|
aws-sam-translator = prev.aws-sam-translator.overridePythonAttrs (_: noTests);
|
|
|
|
moto = prev.moto.overridePythonAttrs (_: noTests);
|
2023-04-07 01:42:21 +02:00
|
|
|
};
|
2024-01-20 16:22:29 +01:00
|
|
|
}).overrideAttrs ({ patches ? [ ], ... }: {
|
|
|
|
patches = patches ++ [
|
|
|
|
../../overlays/home-assistant-no-cloud.diff
|
|
|
|
];
|
|
|
|
|
|
|
|
doInstallCheck = false;
|
|
|
|
});
|
2023-04-07 01:42:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
nginx = {
|
|
|
|
enable = true;
|
|
|
|
virtualHosts."home-assistant.hq.c3d2.de" = {
|
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:${toString config.services.home-assistant.config.http.server_port}";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-07-02 20:38:33 +02:00
|
|
|
portunus.addToHosts = true;
|
2023-04-07 01:42:21 +02:00
|
|
|
};
|
|
|
|
|
2023-11-14 02:30:12 +01:00
|
|
|
sops.defaultSopsFile = ./secrets.yaml;
|
|
|
|
|
2023-04-07 01:42:21 +02:00
|
|
|
system.stateVersion = "22.11";
|
|
|
|
}
|