Update + home assistent -> prometheus

This commit is contained in:
Aleksandr Lebedev 2025-09-29 23:34:18 +02:00
parent 4b6fc29c91
commit 31833e1681
5 changed files with 146 additions and 2718 deletions

2817
flake.lock generated

File diff suppressed because it is too large Load diff

View file

@ -20,14 +20,9 @@
master = { master = {
url = "github:nixos/nixpkgs?ref=master"; url = "github:nixos/nixpkgs?ref=master";
}; };
neovim = {
url = "github:kylekrein/neovim";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
stylix.url = "github:danth/stylix?ref=release-25.05"; stylix.url = "github:danth/stylix?ref=release-25.05";
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest"; nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest";
apple-silicon-support.url = "github:nix-community/nixos-apple-silicon";
sops-nix.url = "github:Mic92/sops-nix"; sops-nix.url = "github:Mic92/sops-nix";
@ -42,19 +37,8 @@
}; };
nixos-facter-modules.url = "github:numtide/nixos-facter-modules"; nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
nix-gaming.url = "github:fufexan/nix-gaming";
impermanence.url = "github:nix-community/impermanence"; impermanence.url = "github:nix-community/impermanence";
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-on-droid = {
url = "github:nix-community/nix-on-droid";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
emacs-kylekrein = { emacs-kylekrein = {
url = "github:kylekrein/emacs-config"; url = "github:kylekrein/emacs-config";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";

View file

@ -19,6 +19,10 @@
trusted_proxies = ["::1"]; trusted_proxies = ["::1"];
use_x_forwarded_for = true; use_x_forwarded_for = true;
}; };
prometheus = {
namespace = "hass";
requires_auth = false;
};
recorder.db_url = "postgresql://@/hass"; recorder.db_url = "postgresql://@/hass";
# Includes dependencies for a basic setup # Includes dependencies for a basic setup
# https://www.home-assistant.io/integrations/default_config/ # https://www.home-assistant.io/integrations/default_config/

View file

@ -27,7 +27,15 @@
{ {
job_name = "stargate"; job_name = "stargate";
static_configs = [ static_configs = [
{targets = ["127.0.0.1:9100"];} {targets = ["localhost:9100"];}
];
}
{
job_name = "hass";
metrics_path = "/api/prometheus";
scrape_interval = "10s";
static_configs = [
{targets = ["localhost:8123"];}
]; ];
} }
]; ];

View file

@ -86,9 +86,20 @@ in {
extraConfig = '' extraConfig = ''
proxy_buffering off; proxy_buffering off;
''; '';
locations."/" = { locations = {
proxyPass = "http://[::1]:8123"; "/" = {
proxyWebsockets = true; proxyPass = "http://[::1]:8123";
proxyWebsockets = true;
};
"/api/prometheus" = {
proxyPass = "http://[::1]:8123";
proxyWebsockets = true;
extraConfig = ''
allow 127.0.0.1;
allow ::1;
deny all;
'';
};
}; };
}; };
"grafana.kylekrein.com" = { "grafana.kylekrein.com" = {