nixos/hosts/architect/teslamate.nix

65 lines
1.3 KiB
Nix
Raw Permalink Normal View History

{ config, ... }:
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
{
age.secrets.teslamate = {
file = ../../secrets/teslamate.age;
owner = "teslamate";
};
2024-11-16 13:19:23 +00:00
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 = config.age.secrets.teslamate.path;
virtualHost = domain;
postgres.enable_server = true;
grafana = {
enable = true;
port = grafanaPort;
listenAddress = "127.0.0.1";
urlPath = "/grafana";
};
mqtt = {
enable = true;
};
2024-11-16 13:19:23 +00:00
};
}