Monitoring + home assistant
This commit is contained in:
parent
ebdfe095d8
commit
4b6fc29c91
4 changed files with 101 additions and 2 deletions
|
|
@ -23,12 +23,10 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
nextcloud-client
|
nextcloud-client
|
||||||
nextcloud-talk-desktop
|
|
||||||
];
|
];
|
||||||
home.persistence = mkIf impermanence.enable {
|
home.persistence = mkIf impermanence.enable {
|
||||||
"${impermanence.persistentStorage}".directories = [
|
"${impermanence.persistentStorage}".directories = [
|
||||||
".config/Nextcloud"
|
".config/Nextcloud"
|
||||||
".config/Nextcloud Talk"
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
47
systems/x86_64-linux/stargate/services/home-assistant.nix
Normal file
47
systems/x86_64-linux/stargate/services/home-assistant.nix
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
services.home-assistant = {
|
||||||
|
enable = true;
|
||||||
|
extraComponents = [
|
||||||
|
# Components required to complete the onboarding
|
||||||
|
"esphome"
|
||||||
|
"met"
|
||||||
|
"radio_browser"
|
||||||
|
"wiz"
|
||||||
|
];
|
||||||
|
config = {
|
||||||
|
http = {
|
||||||
|
server_host = "::1";
|
||||||
|
trusted_proxies = ["::1"];
|
||||||
|
use_x_forwarded_for = true;
|
||||||
|
};
|
||||||
|
recorder.db_url = "postgresql://@/hass";
|
||||||
|
# Includes dependencies for a basic setup
|
||||||
|
# https://www.home-assistant.io/integrations/default_config/
|
||||||
|
default_config = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
services.home-assistant = {
|
||||||
|
package =
|
||||||
|
(pkgs.home-assistant.override {
|
||||||
|
extraPackages = py: with py; [psycopg2];
|
||||||
|
}).overrideAttrs (oldAttrs: {
|
||||||
|
doInstallCheck = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
services.postgresql = {
|
||||||
|
enable = true;
|
||||||
|
ensureDatabases = ["hass"];
|
||||||
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = "hass";
|
||||||
|
ensureDBOwnership = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
35
systems/x86_64-linux/stargate/services/monitoring.nix
Normal file
35
systems/x86_64-linux/stargate/services/monitoring.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
# https://dataswamp.org/~solene/2022-09-11-exploring-monitoring-stacks.html
|
||||||
|
{
|
||||||
|
services.grafana = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
server = {
|
||||||
|
http_addr = "127.0.0.1";
|
||||||
|
http_port = 3000;
|
||||||
|
# Grafana needs to know on which domain and URL it's running
|
||||||
|
domain = "kylekrein.com";
|
||||||
|
root_url = "https://grafana.kylekrein.com/";
|
||||||
|
serve_from_sub_path = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
services.prometheus.exporters.node.enable = true;
|
||||||
|
|
||||||
|
services.prometheus = {
|
||||||
|
enable = true;
|
||||||
|
scrapeConfigs = [
|
||||||
|
{
|
||||||
|
job_name = "stargate";
|
||||||
|
static_configs = [
|
||||||
|
{targets = ["127.0.0.1:9100"];}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -80,6 +80,25 @@ in {
|
||||||
proxyWebsockets = true;
|
proxyWebsockets = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
"smart-home.kylekrein.com" = {
|
||||||
|
forceSSL = true;
|
||||||
|
enableACME = true;
|
||||||
|
extraConfig = ''
|
||||||
|
proxy_buffering off;
|
||||||
|
'';
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://[::1]:8123";
|
||||||
|
proxyWebsockets = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"grafana.kylekrein.com" = {
|
||||||
|
forceSSL = true;
|
||||||
|
enableACME = true;
|
||||||
|
locations."/" = {
|
||||||
|
proxyPass = "http://${toString config.services.grafana.settings.server.http_addr}:${toString config.services.grafana.settings.server.http_port}";
|
||||||
|
proxyWebsockets = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
"paperless.kylekrein.com" = {
|
"paperless.kylekrein.com" = {
|
||||||
enableACME = true;
|
enableACME = true;
|
||||||
forceSSL = true;
|
forceSSL = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue