mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
feat(monitoring): home-assistant
This commit is contained in:
parent
2ed7d5516d
commit
3991badf2c
5 changed files with 22 additions and 4 deletions
|
|
@ -20,7 +20,7 @@ in {
|
|||
(nginx.virtualHosts.grocy.proxied.cloudflared.getIngress {})
|
||||
(nginx.virtualHosts.barcodebuddy.proxied.cloudflared.getIngress {})
|
||||
(
|
||||
if home-assistant.reverseProxy.auth.enable
|
||||
if nginx.virtualHosts.home-assistant.proxied.enable or false != false
|
||||
then (nginx.virtualHosts.home-assistant.proxied.cloudflared.getIngress {})
|
||||
else {
|
||||
${home-assistant.domain} = assert home-assistant.enable && home-assistant.reverseProxy.enable; {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.lists) optional;
|
||||
hassOpenMetrics = true;
|
||||
hassVouchAuth = false;
|
||||
hassVouch = false;
|
||||
in {
|
||||
|
|
@ -29,7 +30,7 @@ in {
|
|||
nixos.barcodebuddy
|
||||
./cloudflared.nix
|
||||
]
|
||||
++ optional hassVouchAuth nixos.access.home-assistant;
|
||||
++ optional (hassVouchAuth || hassOpenMetrics) nixos.access.home-assistant;
|
||||
|
||||
services.nginx = {
|
||||
proxied.enable = true;
|
||||
|
|
@ -37,7 +38,7 @@ in {
|
|||
zigbee2mqtt.proxied.enable = "cloudflared";
|
||||
grocy.proxied.enable = "cloudflared";
|
||||
barcodebuddy.proxied.enable = "cloudflared";
|
||||
home-assistant = mkIf hassVouchAuth {
|
||||
home-assistant = mkIf (hassVouchAuth || hassOpenMetrics) {
|
||||
proxied.enable = "cloudflared";
|
||||
vouch.enable = mkIf hassVouch true;
|
||||
};
|
||||
|
|
@ -47,6 +48,15 @@ in {
|
|||
reverseProxy.auth.enable = true;
|
||||
};
|
||||
|
||||
assertions = let
|
||||
inherit (config.services) home-assistant;
|
||||
in [
|
||||
(mkIf home-assistant.enable {
|
||||
assertion = hassOpenMetrics != home-assistant.config.prometheus.requires_auth or true;
|
||||
message = "home-assistant.config.prometheus.requires_auth set incorrectly";
|
||||
})
|
||||
];
|
||||
|
||||
sops.defaultSopsFile = ./secrets.yaml;
|
||||
|
||||
system.stateVersion = "23.11";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue