mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-11 07:10:39 +02:00
chore: rework home assistant config
This commit is contained in:
parent
4e46105e5e
commit
6c731eede4
12 changed files with 73 additions and 81 deletions
|
@ -100,8 +100,10 @@ in {
|
||||||
proxyPass = "http://grafana";
|
proxyPass = "http://grafana";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
|
# FIXME: refer to lan 192.168... and fd10:: via globals
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
allow 192.168.1.0/24;
|
allow 192.168.1.0/24;
|
||||||
|
allow fd10::/64;
|
||||||
deny all;
|
deny all;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -224,9 +224,11 @@ in {
|
||||||
proxyPass = "http://immich";
|
proxyPass = "http://immich";
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
|
# FIXME: refer to lan 192.168... and fd10:: via globals
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
client_max_body_size 10G;
|
client_max_body_size 10G;
|
||||||
allow 192.168.1.0/24;
|
allow 192.168.1.0/24;
|
||||||
|
allow fd10::/64;
|
||||||
deny all;
|
deny all;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -61,9 +61,11 @@ in {
|
||||||
virtualHosts.${paperlessDomain} = {
|
virtualHosts.${paperlessDomain} = {
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
useACMEWildcardHost = true;
|
useACMEWildcardHost = true;
|
||||||
|
# FIXME: refer to lan 192.168... and fd10:: via globals
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
client_max_body_size 512M;
|
client_max_body_size 512M;
|
||||||
allow 192.168.1.0/24;
|
allow 192.168.1.0/24;
|
||||||
|
allow fd10::/64;
|
||||||
deny all;
|
deny all;
|
||||||
'';
|
'';
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
|
|
|
@ -155,7 +155,7 @@ in {
|
||||||
# Deny access to all hosts by default.
|
# Deny access to all hosts by default.
|
||||||
"hosts deny = 0.0.0.0/0"
|
"hosts deny = 0.0.0.0/0"
|
||||||
# Allow access to local network and TODO: wireguard
|
# Allow access to local network and TODO: wireguard
|
||||||
"hosts allow = 192.168.1.0/24"
|
"hosts allow = 192.168.1.0/24 fd10::/64"
|
||||||
# Don't advertise inaccessible shares to users
|
# Don't advertise inaccessible shares to users
|
||||||
"access based share enum = yes"
|
"access based share enum = yes"
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ in {
|
||||||
option-data = [
|
option-data = [
|
||||||
{
|
{
|
||||||
name = "routers";
|
name = "routers";
|
||||||
data = net.cidr.host 1 lanCidrv4;
|
data = net.cidr.host 1 lanCidrv4; # FIXME: how to advertise v6 address also?
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
reservations = [
|
reservations = [
|
||||||
|
|
|
@ -17,8 +17,8 @@ in {
|
||||||
|
|
||||||
#./esphome.nix
|
#./esphome.nix
|
||||||
./fs.nix
|
./fs.nix
|
||||||
#./home-assistant.nix
|
./home-assistant.nix
|
||||||
#./hostapd.nix
|
./hostapd.nix
|
||||||
#./mosquitto.nix
|
#./mosquitto.nix
|
||||||
./kea.nix
|
./kea.nix
|
||||||
./net.nix
|
./net.nix
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
config,
|
config,
|
||||||
nodes,
|
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
sentinelCfg = nodes.sentinel.config;
|
homeDomain = "home.${config.repo.secrets.global.domains.me}";
|
||||||
homeDomain = "home.${sentinelCfg.repo.secrets.global.domains.personal}";
|
|
||||||
in {
|
in {
|
||||||
|
wireguard.proxy-home.firewallRuleForNode.ward.allowedTCPPorts = [
|
||||||
|
config.services.home-assistant.config.http.server_port
|
||||||
|
];
|
||||||
|
|
||||||
environment.persistence."/persist".directories = [
|
environment.persistence."/persist".directories = [
|
||||||
{
|
{
|
||||||
directory = config.services.home-assistant.configDir;
|
directory = config.services.home-assistant.configDir;
|
||||||
|
@ -27,23 +29,24 @@ in {
|
||||||
"fritzbox"
|
"fritzbox"
|
||||||
"soundtouch"
|
"soundtouch"
|
||||||
"spotify"
|
"spotify"
|
||||||
"zha"
|
#"zha"
|
||||||
"mqtt"
|
"mqtt"
|
||||||
];
|
];
|
||||||
config = {
|
config = {
|
||||||
http = {
|
http = {
|
||||||
server_host = ["127.0.0.1"];
|
server_host = ["0.0.0.0"];
|
||||||
server_port = 8123;
|
server_port = 8123;
|
||||||
use_x_forwarded_for = true;
|
use_x_forwarded_for = true;
|
||||||
trusted_proxies = ["127.0.0.1"];
|
trusted_proxies = ["127.0.0.1"];
|
||||||
};
|
};
|
||||||
|
|
||||||
homeassistant = {
|
homeassistant = {
|
||||||
name = "!secret ha_name";
|
name = "!secret ha_name";
|
||||||
latitude = "!secret ha_latitude";
|
latitude = "!secret ha_latitude";
|
||||||
longitude = "!secret ha_longitude";
|
longitude = "!secret ha_longitude";
|
||||||
elevation = "!secret ha_elevation";
|
elevation = "!secret ha_elevation";
|
||||||
currency = "!secret ha_currency";
|
currency = "EUR";
|
||||||
time_zone = "!secret ha_time_zone";
|
time_zone = "Europe/Berlin";
|
||||||
unit_system = "metric";
|
unit_system = "metric";
|
||||||
#external_url = "https://";
|
#external_url = "https://";
|
||||||
packages = {
|
packages = {
|
||||||
|
@ -53,49 +56,31 @@ in {
|
||||||
|
|
||||||
#### only selected components from default_config ####
|
#### only selected components from default_config ####
|
||||||
|
|
||||||
automation = {};
|
assist_pipeline = {};
|
||||||
backup = {};
|
|
||||||
bluetooth = {};
|
bluetooth = {};
|
||||||
#cloud = {};
|
#cloud = {};
|
||||||
config = {};
|
|
||||||
#conversation = {};
|
#conversation = {};
|
||||||
counter = {};
|
|
||||||
dhcp = {};
|
dhcp = {};
|
||||||
energy = {};
|
energy = {};
|
||||||
frontend = {
|
|
||||||
#themes = "!include_dir_merge_named themes";
|
|
||||||
};
|
|
||||||
hardware = {};
|
|
||||||
history = {};
|
history = {};
|
||||||
homeassistant_alerts = {};
|
homeassistant_alerts = {};
|
||||||
image_upload = {};
|
|
||||||
input_boolean = {};
|
|
||||||
input_button = {};
|
|
||||||
input_datetime = {};
|
|
||||||
input_number = {};
|
|
||||||
input_select = {};
|
|
||||||
input_text = {};
|
|
||||||
logbook = {};
|
logbook = {};
|
||||||
logger = {};
|
|
||||||
map = {};
|
map = {};
|
||||||
#media_source = {};
|
#media_source = {};
|
||||||
mobile_app = {};
|
mobile_app = {};
|
||||||
#my = {};
|
my = {};
|
||||||
network = {};
|
|
||||||
person = {};
|
|
||||||
schedule = {};
|
|
||||||
scene = {};
|
|
||||||
script = {};
|
|
||||||
ssdp = {};
|
ssdp = {};
|
||||||
stream = {};
|
stream = {};
|
||||||
sun = {};
|
sun = {};
|
||||||
system_health = {};
|
|
||||||
tag = {};
|
|
||||||
timer = {};
|
|
||||||
#usb = {};
|
#usb = {};
|
||||||
webhook = {};
|
webhook = {};
|
||||||
zeroconf = {};
|
zeroconf = {};
|
||||||
zone = {};
|
|
||||||
|
backup = {};
|
||||||
|
config = {};
|
||||||
|
frontend = {
|
||||||
|
#themes = "!include_dir_merge_named themes";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
extraPackages = python3Packages: with python3Packages; [psycopg2];
|
extraPackages = python3Packages: with python3Packages; [psycopg2];
|
||||||
};
|
};
|
||||||
|
@ -112,49 +97,37 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO
|
|
||||||
# - auth for zigbee2mqtt frontend
|
|
||||||
# - auth for esphome dashboard
|
|
||||||
# - only allow connections from privileged LAN to HA or from vpn range
|
|
||||||
|
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
upstreams.homeassistant = {
|
upstreams.homeassistant = {
|
||||||
servers."localhost:${toString config.services.home-assistant.config.http.server_port}" = {};
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
zone homeassistant 64k;
|
zone homeassistant 64k;
|
||||||
keepalive 2;
|
keepalive 2;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
virtualHosts.${homeDomain} = {
|
|
||||||
forceSSL = true;
|
|
||||||
enableACME = true;
|
|
||||||
locations."/" = {
|
|
||||||
proxyPass = "http://homeassistant";
|
|
||||||
proxyWebsockets = true;
|
|
||||||
};
|
|
||||||
# TODO listenAddresses = ["127.0.0.1" "[::1]"];
|
|
||||||
# TODO dynamic definitions for the "local" network, IPv6
|
|
||||||
extraConfig = ''
|
|
||||||
allow 192.168.0.0/22;
|
|
||||||
deny all;
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes.sentinel = {
|
nodes.ward = {
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
upstreams."zackbiene" = {
|
upstreams."home-assistant" = {
|
||||||
servers."${config.wireguard.proxy-sentinel.ipv4}:80" = {};
|
servers."${config.wireguard.proxy-home.ipv4}:${toString config.services.home-assistant.config.http.server_port}" = {};
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
zone zackbiene 64k;
|
zone home-assistant 64k;
|
||||||
keepalive 2;
|
keepalive 2;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
virtualHosts.${homeDomain} = {
|
virtualHosts.${homeDomain} = {
|
||||||
# useACMEWildcardHost = true;
|
forceSSL = true;
|
||||||
# TODO add aliases
|
enableACME = true;
|
||||||
rejectSSL = true; # TODO TLS SNI pass with `ssl_preread on;`
|
locations."/" = {
|
||||||
locations."/".proxyPass = "http://zackbiene";
|
proxyPass = "http://home-assistant";
|
||||||
|
proxyWebsockets = true;
|
||||||
|
};
|
||||||
|
# FIXME: refer to lan 192.168... and fd10:: via globals
|
||||||
|
extraConfig = ''
|
||||||
|
allow 192.168.1.0/24;
|
||||||
|
allow fd10::/64;
|
||||||
|
deny all;
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{config, ...}: {
|
{config, ...}: {
|
||||||
# Associates each known client to a unique password
|
# Associates a mandatory and unique password to each client
|
||||||
|
# TODO: autogenerate? via secret generators and derived secrets?
|
||||||
age.secrets.wifi-clients.rekeyFile = ./secrets/wifi-clients.age;
|
age.secrets.wifi-clients.rekeyFile = ./secrets/wifi-clients.age;
|
||||||
|
|
||||||
hardware.wirelessRegulatoryDatabase = true;
|
hardware.wirelessRegulatoryDatabase = true;
|
||||||
|
|
|
@ -8,9 +8,7 @@
|
||||||
in {
|
in {
|
||||||
networking.hostId = config.repo.secrets.local.networking.hostId;
|
networking.hostId = config.repo.secrets.local.networking.hostId;
|
||||||
|
|
||||||
wireguard.proxy-home = {
|
wireguard.proxy-home.client.via = "ward";
|
||||||
client.via = "ward";
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.initrd.systemd.network = {
|
boot.initrd.systemd.network = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -55,7 +53,12 @@ in {
|
||||||
|
|
||||||
zones = {
|
zones = {
|
||||||
untrusted.interfaces = ["lan1"];
|
untrusted.interfaces = ["lan1"];
|
||||||
lan.interfaces = ["lan1"];
|
lan-interface.interfaces = ["lan1"];
|
||||||
|
lan = {
|
||||||
|
parent = "lan-interface";
|
||||||
|
ipv4Addresses = ["192.168.1.0/24"]; # FIXME: refer to via globals
|
||||||
|
ipv6Addresses = ["fd10::/64"]; # FIXME: refer to via globals
|
||||||
|
};
|
||||||
iot.interfaces = ["wlan1"];
|
iot.interfaces = ["wlan1"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
age-encryption.org/v1
|
age-encryption.org/v1
|
||||||
-> X25519 90GQu1DAxHxwy1GWOAE1rHYoQs77Q35YPuQCRTgcWFk
|
-> X25519 /fHu4GoqBkVzZqZJ38xy8XbcWQ6SF3X6rvYjFv8gums
|
||||||
3AefIIsdsaE/exhb7acz/Vh4OBKIl15rRxFnndo6g2I
|
4FPbuUEYdrFpv72oo8+VL8rxdQzDFMgy7lfYp/e6PWc
|
||||||
-> piv-p256 xqSe8Q A+/OdhOqSsDgiaYVOoa7Tnk/JZdSGgHJ094mtoort+V3
|
-> piv-p256 xqSe8Q A7xG4f2f/SRpM1RIQSVL9q8g/AzVcIrDWq7nGDJQimQo
|
||||||
tBDFM3y1wDUt2UzjMLgFWprcFSPp25djnJAqXah4/+4
|
rL9Wgz4z18F5Qn+5Z20N7356YVLLrJvtvtGgx0jJwm4
|
||||||
-> ;[OuQ^De-grease Ce@IYqTR
|
-> u[-grease ad
|
||||||
B85uiwRHPv4yBPoaXxIvJJb9s+UGkfF/KQ1mEIoBu9XBArYESFmj+kLcSWgLI1r5
|
4NbLgEGN91yifuQh9zzwJegrU3ZvxOqtHsCn3XAXpQpv0x9f0HXMGJ2HJnB3dNXL
|
||||||
CI26cYM
|
bxLtOZDlNinTOnR0p6ygxhg
|
||||||
--- K9FHvO0db0Xe6pGjnbLeJRqHGI+lFFnFoo6/R5d8dZ4
|
--- uCx7X+ivq3iUCwYZjIcNZfHgfkzeuTGnG7lsVyKLqTk
|
||||||
>©ˆqñOhÓ¦qP
|
ßSª#:.éá}"5Â�˜:¦Ÿ¢—ÂM1Cʇug-é6UºFfÎ:kj�qœ’0ô‡”`~’IÐÿTL{P5ðZ3tw¥]¯º*YŠOçYS9¢üË"#ø9Ô|WE"—íz4G“tÖ!k\YÒ—O(�{úð”~¡ßGˆWÕ_îÎàhŸ$@
|
||||||
)ư„%®É>ÂôÔ|ÁÀÒzNjóG•<à3S´àÝR‰2¶±^?\|ßD�EÏ2œÕ'€ �±[l‡fL³*GªùQ
ùUk#JEÞGàxЪ-Šù*̬Bnµƒç"šq;£©¾Â‘{Ê
|
|
||||||
ì¬{ü僦°�ì{!)ðŒ˜w÷ÝÃU
w½H„}àŒòýœüîïæDÕ„5jRWîLC�l8_Ù¢G
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 DynNMA LHq3/m3kKCvk3cTzGFp8WIQ8uwB7izjVOZ/k/J+lbAE
|
||||||
|
u2Wh/dTlWa39hqshp8uQEaUW/EHovCvLn6OJ7mJapgw
|
||||||
|
-> j.F8#}r^-grease "y
|
||||||
|
F2G++oErF6R9OUHv8vyUIQMVr76UQgihDZ0mtCSV4Y//8OOw
|
||||||
|
--- bDukn+c2gV2ChC+26cuBFe2j/ObgYGK9OIJsXVRyO8U
|
||||||
|
Ô¦®¿È ómëYS¹˜Ò¤##Vn÷íŽv•§ò»áŸÎ5ñ$œ]UuÞ†VŒ=ƒL5|/ýbOü’0áyÁ@-j3¦W?ûí|rK‡8Î)]»Ü6Ït¦EÆE
|
||||||
|
Iu÷”çÏ=0´ñ¿�Æ…;^ÎÇ•O2*æà©¿ É;–ZTþq~)‰õ>u¡Çc“|7ùê,TEêpxmù.µ…�ï’ÒÂô'ìÅÓ×[óŸ§éŽ’‘š,1˜RPÓfúÒx¡-EøADé”ç3¥¾cÄN¨�¡Ïùî´ñëJè˜�§=”q³˜Ú¤GÕý�³ì�%½œîUN’R½ÌÚcåc Âðá¶\/çóecÚFÌoùfúú
|
||||||
|
nÍŒoø ³öîµ”µô°£µ.¼ÈáhÅSÇ„élt{)�<ǵШѧc¼�*¶¥Ósòçõ
¼·T‚d]
|
||||||
|
^•tÄDéØ÷�E0C`&yõ=Ç$7À¶úº�6=iÀÌ'Àú¹ø0?ú>p
|
||||||
|
pÜ£òðTl5§míi (�Õüðk«ûíº-µÐìã¦ÄZ©_ªòg)·®Ô*k#Îú?êϦP¤_šPÏè=X¦�C™?¾‰´Ùk«¯£ÂN3ò{eðhA.3þÓÓ¨î½Ø‰,Æ5AuÛt™Êƒà%^|የ’0¶ãúchgKy¦5+îO3Íbojì-W�_*Ý
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue