mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
chore(monitoring): clean up hass changes
This commit is contained in:
parent
3991badf2c
commit
409d711175
5 changed files with 36 additions and 54 deletions
|
|
@ -1,11 +1,10 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
access,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkMerge;
|
||||
inherit (config.services) home-assistant nginx;
|
||||
inherit (config.services) nginx;
|
||||
cfg = config.services.cloudflared;
|
||||
apartment = "5e85d878-c6b2-4b15-b803-9aeb63d63543";
|
||||
in {
|
||||
|
|
@ -19,15 +18,7 @@ in {
|
|||
(nginx.virtualHosts.zigbee2mqtt.proxied.cloudflared.getIngress {})
|
||||
(nginx.virtualHosts.grocy.proxied.cloudflared.getIngress {})
|
||||
(nginx.virtualHosts.barcodebuddy.proxied.cloudflared.getIngress {})
|
||||
(
|
||||
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; {
|
||||
service = access.proxyUrlFor {serviceName = "home-assistant";};
|
||||
};
|
||||
}
|
||||
)
|
||||
(nginx.virtualHosts.home-assistant.proxied.cloudflared.getIngress {})
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,36 +1,31 @@
|
|||
{
|
||||
config,
|
||||
meta,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.lists) optional;
|
||||
hassOpenMetrics = true;
|
||||
hassVouchAuth = false;
|
||||
hassVouch = false;
|
||||
in {
|
||||
imports = let
|
||||
inherit (meta) nixos;
|
||||
in
|
||||
[
|
||||
nixos.reisen-ct
|
||||
nixos.sops
|
||||
nixos.tailscale
|
||||
nixos.cloudflared
|
||||
nixos.postgres
|
||||
nixos.nginx
|
||||
nixos.access.zigbee2mqtt
|
||||
nixos.access.grocy
|
||||
nixos.access.barcodebuddy
|
||||
nixos.home-assistant
|
||||
nixos.zigbee2mqtt
|
||||
nixos.syncplay
|
||||
nixos.grocy
|
||||
nixos.barcodebuddy
|
||||
./cloudflared.nix
|
||||
]
|
||||
++ optional (hassVouchAuth || hassOpenMetrics) nixos.access.home-assistant;
|
||||
in [
|
||||
nixos.reisen-ct
|
||||
nixos.sops
|
||||
nixos.tailscale
|
||||
nixos.cloudflared
|
||||
nixos.postgres
|
||||
nixos.nginx
|
||||
nixos.access.home-assistant
|
||||
nixos.access.zigbee2mqtt
|
||||
nixos.access.grocy
|
||||
nixos.access.barcodebuddy
|
||||
nixos.home-assistant
|
||||
nixos.zigbee2mqtt
|
||||
nixos.syncplay
|
||||
nixos.grocy
|
||||
nixos.barcodebuddy
|
||||
./cloudflared.nix
|
||||
];
|
||||
|
||||
services.nginx = {
|
||||
proxied.enable = true;
|
||||
|
|
@ -38,25 +33,16 @@ in {
|
|||
zigbee2mqtt.proxied.enable = "cloudflared";
|
||||
grocy.proxied.enable = "cloudflared";
|
||||
barcodebuddy.proxied.enable = "cloudflared";
|
||||
home-assistant = mkIf (hassVouchAuth || hassOpenMetrics) {
|
||||
home-assistant = {
|
||||
proxied.enable = "cloudflared";
|
||||
vouch.enable = mkIf hassVouch true;
|
||||
};
|
||||
};
|
||||
};
|
||||
services.home-assistant = mkIf hassVouchAuth {
|
||||
reverseProxy.auth.enable = true;
|
||||
services.home-assistant = {
|
||||
#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