nixos/hosts/architect/teslamate.nix

52 lines
1.1 KiB
Nix
Raw Normal View History

{ config, pkgs, ... }:
2024-11-16 13:19:23 +00:00
let
domain = "tesla.giugl.io";
teslamatePort = 11234;
grafanaPort = 11334;
2024-11-16 13:19:23 +00:00
allowLan = true;
allowWAN = false;
2024-11-16 13:19:23 +00:00
in
{
architect.vhost.${domain} = with config.architect.networks; {
dnsInterfaces = [ "lan" "tailscale" ];
locations = {
"/" = {
inherit allowLan allowWAN;
port = teslamatePort;
proxyWebsockets = true;
2024-11-16 13:19:23 +00:00
allow = [
tailscale.net
];
};
"/live/websocket" = {
inherit allowLan allowWAN;
port = teslamatePort;
proxyWebsockets = true;
allow = [
tailscale.net
];
};
"/grafana" = {
inherit allowLan allowWAN;
port = grafanaPort;
2024-11-16 13:19:23 +00:00
proxyWebsockets = true;
allow = [
tailscale.net
];
};
};
};
services.teslamate = {
enable = true;
port = teslamatePort;
listenAddress = "127.0.0.1";
secretsFile = "/secrets/teslamate/teslamate.env";
virtualHost = domain;
postgres.enable_server = true;
grafana = { enable = true; port = grafanaPort; listenAddress = "127.0.0.1"; urlPath = "/grafana"; };
2024-11-16 13:19:23 +00:00
};
}